Howdy, Stranger!

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

Supported by

How to target specific row in a table

Hi everyone,

Is it possible to target a specific row in a table with a JS inline script? My goal is to set up custom "orderings" instead of relying on either sequential or random orderings, for instance starting to row n where n can be a number I decided earlier. I know how to retrieve the index of a loop, but I don't know how to actually select that row.

runner._experiment.experiment.items._items.new_loop._index

Any ideas how I can proceed?

Thanks,

Silk--

Comments

  • Hi @Silk ,

    Yes it's possible, though admittedly not very user friendly because you'll have to dive deep into the internals of OSWeb (as you're already doing). The loop table is called matrix and is structured as an array of objects. The screenshot below of the browser console shows the general idea:

    https://forum.cogsci.nl/uploads/910/ZWKPGCPFBCBD.png There was an error displaying this embed.

    Is this helpful?

    — Sebastiaan

  • Hi @sebastiaan ,

    Thanks, that's indeed what I was looking for. By digging a bit further into those internals, I found apply_cycle() , which is quite a handy trick to choose a specific object of the matrix.

    block_loop = runner._experiment.items._items['block_loop']
    block_loop.apply_cycle(0)
    

    This latter can be useful to play with stimuli's order, for instance. I imagine having an array of integers that is basically a list of item numbers, and use that list to decide which stimuli to show.

    item_list = [3,1,2,0]
    block_loop.apply_cycle(item_list.shift())
    
    // .shift() removes the first element of an array and returns that element
    

    --Silk

Sign In or Register to comment.