Reply To: Get the previous row of a column

PennController for IBEX Forums Support Get the previous row of a column Reply To: Get the previous row of a column


Hi Larissa,

A few comments:

  • getVar("errorNum").set(0): this won’t work, because you never create a Var element named “errorNum”
  • newVar("errorCount").set( errorNum + 1): this will always set the value to 1, because you set the javascript variable errorNum to 0 at the top of your script and never update it
  • newText("lastLen", row.lenNumeric).map((w,i) => `${w[i - 1]}`): you are using .map on the closing parenthesis of newText() but there is no command called map on Text elements. It wouldn’t make sense to call .map on row.lenNumeric either, since row.lenNumeric is not an Array (which is the type of object on which the map method is defined)

I have created a project here to illustrate how to implement the logic you describe (I didn’t include any audio playback or recording). What allows one to share information from one trial to the next is the Var element’s .global command