Reply To: Branching Structure for filtering participants

PennController for IBEX Forums Support Branching Structure for filtering participants Reply To: Branching Structure for filtering participants

#10733
Jeremy
Keymaster

Hi,

I think there’s a bug with calling SendResults from within Header (also you wouldn’t need any Timer or callback there anyway). One alternative would be to create a SendResults and a final trials specifically for the too-many-errors scenario, placed after the regular ones and only accessed from that failure command. Here’s a basic illustration of the idea, which you can adapt to your needs:

Sequence( randomize("experiment"), "normalSend", "normalEnd", "errorSend", "errorEnd")

SendResults("normalSend")
newTrial("normalEnd", newText("Congrats, you did it!").print(), newButton().wait() )

SendResults("errorSend")
newTrial("errorEnd", newText("Sorry, too many mistakes. The end.").print(), newButton().wait() )

Header(
    newVar("error_count",0) // set the initial value to 0
        .global()           // make sure the Var element is global
        .test.is(v=>v&ltl3)    // the value should be below 3
        .failure( jump("errorSend") , getVar("error_count").set(0) , end() )
)

Jeremy