Hello all,
I have a question where a survey taker selects something from a drop down on one page and then on the next page I pipe over their selection and allow them to add comments to their selection. I'd like to set a default choice (piped embedded data) in the comment on the 2nd page based on what the selected on the previous page.
I cannot use display logic for this for practicality reasons. They can have up-to 10 selections on the 1st page and 9 choices, which means I'd have to program 90 different display logics. I also can't set embedded data in the survey flow because these questions are in a block inside a Table of Contents element and Qualtrics doesn't allow that.
Here are the questions I am working on to help explain my situation: https://bcbssc.az1.qualtrics.com/jfe/preview/SV_0qyUIMga3bOFHRr/BL_0k2JLFSZAotgszr?Q_SurveyVersionID=current
1. Enter a number 1-10 to populate up-to 10 line items.
2. Choose 1 of the 9 choices under "Data Feed Type" for each line item.
3. On the last page, I'd like "Charge" to default to an embedded data set earlier based on which choice is chosen for each line item. Ideally the default choice would only show for the given Data Feed Type if Standard is selected under charge, but that is less important.
Page 1 / 1
There are two ways you could go here:
1. Along the lines of you current thinking...add an addOnPageSubmit function to the second question and set embedded variables based on the selected choices in the second question. Then make those embedded variables the default choices in the third question.
2. Pipe the answers from the second question into the addOnload function in the third question then set the values of the input fields based on the piped answers.
Either would work, but I prefer option 2 because it is all self-contained and easier to code if you do it right.
For option 2, since you need to know two fields for each row (data feed type and standard/non-standard), pipe the answers into an array of objects. Also define an object with charges. Then loop through the array, apply logic, and set the input value from the charges object.
1. Along the lines of you current thinking...add an addOnPageSubmit function to the second question and set embedded variables based on the selected choices in the second question. Then make those embedded variables the default choices in the third question.
2. Pipe the answers from the second question into the addOnload function in the third question then set the values of the input fields based on the piped answers.
Either would work, but I prefer option 2 because it is all self-contained and easier to code if you do it right.
For option 2, since you need to know two fields for each row (data feed type and standard/non-standard), pipe the answers into an array of objects. Also define an object with charges. Then loop through the array, apply logic, and set the input value from the charges object.
@TomgG - Thanks for you help!
So I need to:
1. Create an array of objects where the array is filled with the piped text I need.
2. Define which objects have "standard" charge selected (as opposed to non-standard charge).
3. Loop through the array to identify which values in the array I need to set in the input section as piped text.
Is that correct?
Do you have any good resources you use or example code of doing any of these things? I am going to pair up with someone who knows JavaScript better then me, but doesn't know Qualtrics very well. I'm hoping that together we can figure this out, but some resources would likely help greatly.
So I need to:
1. Create an array of objects where the array is filled with the piped text I need.
2. Define which objects have "standard" charge selected (as opposed to non-standard charge).
3. Loop through the array to identify which values in the array I need to set in the input section as piped text.
Is that correct?
Do you have any good resources you use or example code of doing any of these things? I am going to pair up with someone who knows JavaScript better then me, but doesn't know Qualtrics very well. I'm hoping that together we can figure this out, but some resources would likely help greatly.
> @TomG said:
> There are two ways you could go here:
>
> 1. Along the lines of you current thinking...add an addOnPageSubmit function to the second question and set embedded variables based on the selected choices in the second question. Then make those embedded variables the default choices in the third question.
>
> 2. Pipe the answers from the second question into the addOnload function in the third question then set the values of the input fields based on the piped answers.
>
> Either would work, but I prefer option 2 because it is all self-contained and easier to code if you do it right.
>
> For option 2, since you need to know two fields for each row (data feed type and standard/non-standard), pipe the answers into an array of objects. Also define an object with charges. Then loop through the array, apply logic, and set the input value from the charges object.
Hey Tom,
Have you ever done anything like this before? If so, would you have sample code I could look through and try to adapt to my my use-case?
> There are two ways you could go here:
>
> 1. Along the lines of you current thinking...add an addOnPageSubmit function to the second question and set embedded variables based on the selected choices in the second question. Then make those embedded variables the default choices in the third question.
>
> 2. Pipe the answers from the second question into the addOnload function in the third question then set the values of the input fields based on the piped answers.
>
> Either would work, but I prefer option 2 because it is all self-contained and easier to code if you do it right.
>
> For option 2, since you need to know two fields for each row (data feed type and standard/non-standard), pipe the answers into an array of objects. Also define an object with charges. Then loop through the array, apply logic, and set the input value from the charges object.
Hey Tom,
Have you ever done anything like this before? If so, would you have sample code I could look through and try to adapt to my my use-case?
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.