Saving the data with subject ID in file name #1699
becky-gilbert
started this conversation in
Show and tell
Replies: 1 comment
-
var id = jsPsych.data.get().filter({task_part: 'id_question'}).values()[0].response.id; Autofocus processing was blocked because a document already has a focused element.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Here's how to generate a random ID for each participant, save it to the data, and save the data as a local file with this ID in the name.
You can use the jsPsych.randomization.randomID function to generate the ID string, and the jsPsych.data.addProperties function to add this ID to the data for all trials. Then to save a file that includes this ID in the file name, you can create a file name variable by joining text and the ID variable with the + operator.
Or, if you want to get the ID from a response that was made during the experiment, you can do that by filtering the data to find the data from the ID question using the
filter
function, then getting the raw data values with thevalues
function, then selecting the first (only) trial in that array, and then finding the value associated with the question called "id" in the "responses" object.Beta Was this translation helpful? Give feedback.
All reactions