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
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 variableerrorNumto 0 at the top of your script and never update itnewText("lastLen", row.lenNumeric).map((w,i) => `${w[i - 1]}`): you are using.mapon the closing parenthesis ofnewText()but there is no command calledmapon Text elements. It wouldn’t make sense to call.maponrow.lenNumericeither, sincerow.lenNumericis not an Array (which is the type of object on which themapmethod 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