run if x in list
in OpenSesame
Dear forum,
Just a simple question. How do i put the code in the run if statement?
The idea was:
[session_nr] in [1,2,4,7,11,12] #seems like this does not work
I also tried
[session_nr] == any[1,2,4,7,11,12] #does not work either
Of course, I could write
[session_nr]==1 or [session_nr]==2 etc. #this is very long, I thought there should be a more convenient option
Maybe you could add an example with 'in' here? [After Fig. 5 i found the 'and' and 'or' functions]
Stephan
Comments
Hi Stephan,
Not the best solution (I am not sure you can use list membership in the run if fields), but maybe you can first define a variable based on the membership in an inline_script?
something like:
if var.session_nr in [1,2,4,7,11,12]: var.first_group = 1 else: var.first_group = 2Then you can use the new variable as run if statement. Would that work?
Weird idea, but works. :)