Nested conditional timelines #1916
-
I am planning a questionnaire at the end of one of my experiments and depending on which answers participants give they will receive further questions or not. To this end, I have a row of several conditional timelines.
The last part can not be evaluated properly if the first conditional timeline has been executed because then the values from the last trial are not "yes" or "no" anymore. How can I pass the information from the variable "text_response" to the second conditional timeline? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @AnneVogt! Instead of getting the previous responses using var instrument_now = {
type: 'survey-multi-choice',
questions: [
{prompt: "Spielen Sie aktuell aktiv ein Instrument?", name: 'instrument_now', options: yes_no_options, required:true, horizontal: true}, ],
data: {question_name: 'instrument_now'} // add a label to the trial data
};
var childhood_instrument = {
type: 'survey-multi-choice',
questions: [
{prompt: "Haben Sie als Kind ein Instrument erlernt?", name: 'childhood_instrument', options: yes_no_options, required:true, horizontal: true}, ],
data: {question_name: 'childhood_instrument'} // add a label to the trial data
}; Then, whenever you want to get the participant's responses to these questions, you can filter the jsPsych data like this: jsPsych.data.get().filter({question_name: 'instrument_now'}).values()[0].responses
jsPsych.data.get().filter({question_name: 'childhood_instrument'}).values()[0].responses Does this solution work for you? |
Beta Was this translation helpful? Give feedback.
-
Thanks you Becky for your quick response. I was able to implement your solution and now the different questions are displayed in the way I intended. |
Beta Was this translation helpful? Give feedback.
Hi @AnneVogt! Instead of getting the previous responses using
getLastTrialData
, what I would do here is use jsPsych's datafilter
function so that you can pick out the trial data that you need, regardless of whether or not the conditionals have run. The easiest way to do this is to add some unique labels to your questions using the trial'sdata
parameter - this way you'll be able to filter on these labels. Here's an example: