PennController for IBEX › Forums › Support › Different sequence for group? › Reply To: Different sequence for group?
March 22, 2022 at 1:53 pm
#7952
Keymaster
Hi,
Use __counter_value_from_server__ to conditionally execute different Sequence commands:
if (__counter_value_from_server__ % 2)
Sequence( "Consent", "block1Instructions", rshuffle("block1"), "block2Instructions", rshuffle("block2"), "block3Instructions", rshuffle("block3"), "block6Instructions", rshuffle("block6"), "block7Instructions", rshuffle("block7"), "block4Instructions", rshuffle("block4"), "block5Instructions", rshuffle("block5"), SendResults() , "Thankyou" )
else
Sequence( "Consent", "block1Instructions", rshuffle("block1"), "block2Instructions", rshuffle("block2"), "block3Instructions", rshuffle("block3"), "block4Instructions", rshuffle("block4"), "block5Instructions", rshuffle("block5"), "block6Instructions", rshuffle("block6"), "block7Instructions", rshuffle("block7"), SendResults() , "Thankyou" )
Template executes its function after the core of the script, so the Var element “blockorder” will not have received its value by the time your if is executed. Also, getVar("blockorder") returns a pointer to the javascript object that represents the Var element, which PennController knows how to interpret, but if you just reference it inside an if like that, you won’t get what you think (ie. you won’t get "A" or "B"). How-to guide: Using JavaScript
Jeremy