PennController for IBEX › Forums › Support › Get the previous row of a column › Reply To: Get the previous row of a column
May 31, 2023 at 4:56 am
#10645
Jeremy
Keymaster
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 variableerrorNum
to 0 at the top of your script and never update itnewText("lastLen", row.lenNumeric).map((w,i) => `${w[i - 1]}`)
: you are using.map
on the closing parenthesis ofnewText()
but there is no command calledmap
on Text elements. It wouldn’t make sense to call.map
onrow.lenNumeric
either, sincerow.lenNumeric
is not an Array (which is the type of object on which themap
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
Jeremy