Replies: 1 comment
-
I'm not sure without seeing the rest of your code. Did you put the on_finish: function () {
var id = jsPsych.data.get().filter({trial_purpose: 'id'}).values()[0].response.id;
jsPsych.data.addProperties({sub_id: id});
var file_name = 'sub_' + id + '_data.csv';
jsPsych.data.displayData()
jsPsych.data.get().localSave('csv', file_name)
var session_trials = $.csv.toObjects(trials_csv)
.filter(x => x.sub_id == parseInt(jsPsych.data.get().filter({trial_purpose: 'id'}).values()[0].response.id))
} What I would do is add some on_finish: function() {
// ...
console.log("ID trial data: ", jsPsych.data.get().filter({trial_purpose: 'id'}).values()[0])
} Looking at this output should give you some clues as to why |
Beta Was this translation helpful? Give feedback.
-
Hi,
I have a CSV file containing all the trials I'd like to present to a participant, based on their ID. Here is the code I have at the beginning of the experiment, which prompts participants to put in their ID:
After that, I tried to filter all my trials using that ID number, like so:
However, the error I keep getting is: Cannot read properties of undefined (reading 'response')
I suspect this is something about the order of what's being run, but I'm not sure. Any help would be appreciated! Thanks!
Beta Was this translation helpful? Give feedback.
All reactions