Different sequence for group?

PennController for IBEX Forums Support Different sequence for group?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #7950
    OwenJames
    Participant

    Hello! I am trying to make my experiment have 2 groups ( A and B) and each group needs to do 7 experimental blocks, only Block A needs to have a different order of the blocks (a set order) than group B. Here is a link: https://farm.pcibex.net/r/bDpPaf/ and I commented the code with which I tried this, but this is the code:

    Template(
      GetTable( "items.csv" )
                .setGroupColumn( "blockorder" ),
      variable =>          
      
     newVar("blockorder").set(variable.blockorder).global().log())
     
    if (getVar("blockorder") == "A") 
    
    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" )
    //use different sequence per group
    else
    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" )

    I get an error with the blockorder variable (use of labelname unknown).

    #7952
    Jeremy
    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

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.