TypeError: cannot read property of 'ps1_cond' of undefined (Note: ps1_cond is a column header)

URL of experiment: https://run.pavlovia.org/VeraLudwig/purm-workplace-experiment-v8/html/?__pilotToken=c81e728d9d4c2f636f067f89cc14862c&__oauthToken=cd3a13639593c1d2f7e7bf0660002490e511525153df09ba063ca079074078d6

Gitlab: https://gitlab.pavlovia.org/VeraLudwig/purm-workplace-experiment-v8

Description of the problem: I originally had a working experiment from Psychopy, but it did not upload to pavlovia. I’ve looked at countless threads and learned that none of the libraries worked so I used a shuffle function and an excel reading function that was shared by dvbridges, which finally got my experiment to run. Now I wanted to put each of the elements in a column to separate lists and my code looks as follows:

ps1_cond = [];
gender_cond = [];
connective_cond = [];
ps2_cond = [];
gender_cond2 = [];
descriptive_cond = [];

for (var rowx = 1, _pj_a = (num_items + 1); (rowx < _pj_a); rowx += 1) {

ps1_cond.push(trialList[rowx]['ps1_cond']);
gender_cond.push(trialList[rowx]['gender_cond']);
ps2_cond.push(trialList[rowx]['ps2_cond']);
gender_cond2.push(trialList[rowx]['gender_cond2']);
if ((valueX >= 6)) {
    connective_cond.push(trialList[rowx]['connective_cond']);
    descriptive_cond.push(trialList[rowx]['descriptive_cond']);
} else {
    connective_cond.push(trialList[rowx]['descriptive_cond']);
    descriptive_cond.push(trialList[rowx]['connective_cond']);
}

}

And the error I got is TypeError: cannot read property of ‘ps1_cond’ of undefined. When I changed the ‘ps1_cond’ from the line ps1_cond.push(trialList[rowx][‘ps1_cond’]); to any other word, it will show up with the same error but with the different word. I saw from dvbridges’ code that he put the column headers in that same spot and it worked, so I’m wondering what is wrong on my part.

I’ve also looked at the example experiment wakecarter provided in his google doc, but I am not very confident with python and JS so I didn’t completely understand how to implement that into what I have.

Try undefined in the JS code instead of None.

Sorry, which part of the code are you referring to? The only time I recall using None was in initialize for tempPic and tempSentence (in python) but I don’t think that was what was causing the ps1_cond issue.

Just changed the two variables tempPic and tempSentence to undefined in the JS code, but I’m still getting the same error.

What is trialList ? Where does that come from?

You could try printing it (console log) to get it’s defined when used.