conditional trials

PennController for IBEX Forums Support conditional trials

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #5182
    kaan
    Participant

    I am using a cvs with the column “Sentence” and “Question”, among others.
    My trial structure looks like this:

    Template( "myTable.csv" ,
         row => newTrial( "experiment" ,        
            newController("DashedSentence", {s: row.Sentence}).print().log().wait()
              .remove()
            ,      
            newText("Question", row.Question).print()             
            ,
            newKey("FJ")
                .wait()
                .log()       
            ,  [etc]

    How can I include a conditional, such that (e.g.) newText(“Question”) and newKey(“FJ”) are only called when the Question cell in myTable is not empty?
    Thanks!

    #5183
    Jeremy
    Keymaster

    Hello,

    You could do something like this:

    Template( "myTable.csv" ,
         row => newTrial( "experiment" ,        
            newController("DashedSentence", {s: row.Sentence}).print().log().wait()
                .remove()
            ,      
            (row.Question?[
              newText("Question", row.Question).print()             
              ,
              newKey("FJ")
                .wait()
                .log()       
            ]:null)
            ,
            [etc]

    Jeremy

    #5184
    kaan
    Participant

    Great! This works, thanks! And thanks for your quick response.

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