Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Programmatic handling of loop properties and contents in inline_javascript

Hi there,

I'm trying to populate the content of a loop from a memory array (as a method to get around the fact that OSWeb does not handle files as a source in loops). I'm making good progress but I'd need to do a couple of things in an inline_javascript that require accessing built-in variable related to loops:

(1) Is it possible to create columns (and name them) and rows in a loop using inline_javascript code?

(2) Is there a way to retrieve the number of rows from a loop within an inline_javascript object?

I'm interested in finding out what OS built-in variables and object properties can be access using javascript. I found some information about how to interact with these using Python code, but not using Javascript.

Any help or pointers much appreciated! Thanks in advance!

Fabrice.

Buy Me A Coffee

Comments

  • Hi Fabrice,

    Not sure whether this will help, but regarding (1), I think it is not necessary to "rebuild" the loop table in that way. I would just have lists (or arrays) of the information I want to retrieve on every trial and assign them to variables by means of a trial index. Do you know what I mean?

    Regarding (2), well, as there are no rows unless you make them, the number of rows is defined by you. So, if you have your conditions and now how many (unique) trials you have, you can define a variable that carries these information. Alternatively, if you only have a list, you could get the lenght of an array with name_of_array.length (I believe, but better check).

    Eduard

    Buy Me A Coffee

  • Hi @eduard ,

    Thanks for these suggestions!

    I came up with the same idea regarding (1). I'm now using a trial index and got it to work. I had some initial difficulties because for some reason, my code doesn't seem to be populating the loop table unless I create the appropriate number of rows and set up the columns with the variable names:

    In the tests I'm doing at the moment, I set up arrays with data for 48 trials, and have loop with 12 trials that gets repeated 4 times. It works, though I'm not sure why I have to preformat the table instead of leaving it empty as @lvanderlinden did in the experiment published in https://forum.cogsci.nl/discussion/6978/randomly-select-some-trials-from-two-distinct-groups. I suspect it might be because I'm implementing the arrays and handle them in a different way. Anyway, it's working.

    Regarding 2, my practice trials are in a standard table and not populated from an array, so I couldn't use the .length property of an array, but it's not a big deal. I know how many trials are in there (8), and so when running my test loop (from an array), I access the items in the test array by using (vars.count_trial_sequence-8). Accessing the number of rows in the practice table would have just saved me a possible error if I later decide to change the number of practice trials (I'd then have to remember to go change that 8 to whatever new value). Might also implement a bit a Javascript to increment a variable counting the practice trials.

    Thanks for your input!

    Cheers,

    Fabrice.

    Buy Me A Coffee

  • Cool, sounds good!

    If I am not mistaken, the loop tables are actually datamatrix objects. So maybe in those docs, you'll find useful info: https://datamatrix.cogsci.nl/

    Eduard

    Buy Me A Coffee

  • Hi @eduard ,

    Thanks for the tip! Will look it up! 👍️

    Fabrice

    Buy Me A Coffee

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games