Changing rows in conditions file dynamically within loop

Hello,
I am trying to select rows from a conditions file dynamically. I also want to dynamically select rows within a single loop.

So, I tried 1 loop, setting the trialProperties Selected row component to a variable ($selectedRow). The variable depends on the response made for each routine.

selectedRow = str(choice-1)+':'+str(choice)

Begin Experiment:

choice = 1

End routine:

if key_resp.keys == '1':
    choice = n1node
if key_resp.keys == '2':
    choice = n2node

n1node and n2node are stimuli.

On the next loop, instead of showing the updated choice (n1node or n2node), the previous stimulus is shown again. Any help is appreciated!!

You can’t change the selected rows once a loop has started. However, you could do it with two concentric loops. Put a Routine in the outer loop (after the inner loop) which sets the selected row for the inner loop (or breaks the outer loop if the task has finished)

As @wakecarter mentioned, you can’t do this out of box. But you can manipulate trials by understanding that “under the hood” a spreadsheet is imported to psychopy as a list of dictionaries. You can make custom trial lists through manipulating that list of dictionaries. It is a bit more involved but here is a tutorial we run in our workshops in this topic.

Hopefully this is helpful,
Becca

Very helpful–thank you!