Setting Embedded Data as Selected Choices from Prior Questions, then Piping into a New Question | XM Community
Question

Setting Embedded Data as Selected Choices from Prior Questions, then Piping into a New Question

  • 30 July 2019
  • 9 replies
  • 195 views

I asked this here https://www.qualtrics.com/community/discussion/5376/javascript-display-logic-for-matrix-table-hide-row-conditional-on-answer-being-piped-in#latest but I think I should've probably started a new question since it's tacked onto a prior thread.

I'm trying to set my embedded data as the selected choices from prior questions (e.g., country1 = ${q://QID73/ChoiceGroup/SelectedChoices}, etc.) and then use those embedded data as piped in choices to a new question. However, it's not working: when I preview, the answer choices to the new question all come up blank. Here are the steps I'm taking:

1) Created country1 through country9 as 9 embedded data variables in survey flow, each with a value that has been defined as a selected choice from a prior question (e.g., country1 = ${q://QID73/ChoiceGroup/SelectedChoices}, etc.

2) Put the green embedded data block from the survey flow prior to the block that contains the question into which I need to pipe the embedded data choices

3) Put a page break between the prior questions and the question into which I'm piping the embedded data

4) Piped in the embedded data as the answer choices for the new question (e.g., ${e://Field/country1}, etc.)

(Note that I cannot just pipe in the selected choices from the prior questions directly into the new question and that I need to use this embedded data route for reasons mentioned in the other post listed above, in case you need more context.)

In case this matters and is having an effect, my selected choices from the prior questions are of the format: ```<span class="choiceText">Afghanistan</span><span class="pipeText">Afghan</span>``` (appears as "AfghanistanAfghan"), again, for reasons mentioned in another post of mine here: https://www.qualtrics.com/community/discussion/5364/using-javascript-in-qualtrics-for-display-logic-when-answers-are-associated-with-hidden-choices#latest

On a side note, if I try creating a question in which I directly pipe in the selected choices from the prior questions, this works. It's only when I try to pipe in the embedded data as the choices to the new question that it does not work. (Again, unfortunately I can't do it this way though for the reasons mentioned in my prior post.)

!

!

!

9 replies

Userlevel 4
Badge +17
Why wouldn't you just carry forward answers into new question. What is the purpose of storing it as Embedded Data? You could also do a loop and merge and then it wouldn't be exposing the recipient to a possibly massive matrix table.
Userlevel 4
Badge +17
Is it because the embedded data is getting set from multiple questions and not one?
MSobotta, as I mentioned above, the answer to that is in my other posts 😀 The embedded data comes from multiple questions, yes, and I need to use the embedded data route because I have to remove duplicates from the responses to the prior questions.
Userlevel 4
Badge +17
Ok let's problem solve. Even if it is not coming across in the question, is it still loading all the embedded data correctly? I.e. do you see it in the response summary?
I tried setting the embedded data to the "question text" for each of the prior questions and it works. So what this means is that it's the formula of the selected choices that is causing the problem. In other words, it appears as if I cannot set embedded data consisting of selected choices from prior questions when those selected choices are in a format such as mine (e.g., ```<span class="choiceText">Afghanistan</span><span class="pipeText">Afghan</span>``` for "AfghanistanAfghan", which I hide the .choiceText from the first part of the text so that it displays as "Afghan"). Is there something that can be done about this? Can I use JavaScript to first delete the .choiceText part, show only the .pipeText part, and then turn the format of the .pipeText part into a regular string instead of its current format? Or would adding something to the selected choices within the survey flow's embedded data work?
Userlevel 4
Badge +17
You still didn't answer the question. Is your embedded data working up and showing properly?
Take a preview test and see if you get the correct embedded data before you insert in the question.
Userlevel 4
Badge +17
I was able do it within testing.
!
!
!
MSobotta, I did answer the question. I said that I am able to see the embedded data being piped through when I use ANY OTHER VALUES, such as you did above. For example, I tried setting the embedded data as the "Question Text" from the prior questions, piped through. The ONLY TIME it's not working is when I'm trying to pipe through the "Selected Choices" from the previous questions, and I know it's because of the FORMAT of those choices (e.g., ```<span class="choiceText">Afghanistan</span><span class="pipeText">Afghan</span>```). What I'm asking is how to RE-FORMAT the selected choices via JavaScript so that they can be used as VALUES for the embedded data and I can RETAIN the ".pipeText" part (e.g., "Afghan" while deleting or hiding the ".choiceText" part (e.g., "Afghanistan"). Your example above is just showing you assigning some values to embedded data and then piping them into a question, which is not at all the extent of what I'm trying to do. I'm trying to pipe through a CERTAIN KIND OF VALUE (e.g., ```<span class="choiceText">Afghanistan</span><span class="pipeText">Afghan</span>```), which is why it's not working.

Example:

```country1=${q://QID73/ChoiceGroup/SelectedChoices}``` in the green survey flow block for embedded data, or the choice that the participant selected for QID73.

But ```${q://QID73/ChoiceGroup/SelectedChoices}=<span class="choiceText">Afghanistan</span><span class="pipeText">Afghan</span>``` (or any other of the countries that might've been chosen for that question, such as ```<span class="choiceText">Zimbabwe</span><span class="pipeText">Zimbabwean</span>```

In other words, if the participant chose Afghanistan for the country1 question, ```country1=<span class="choiceText">Afghanistan</span><span class="pipeText">Afghan</span>``` in the green embedded data survey flow block, and the embedded data apparently cannot handle the answer's formatting as it is, which is why I need to re-format it somehow with JavaScript.

See below. Q12=QID73 and the jQuery hiding the .pipeText applies to this question.

!

!

!

!

!

!
Userlevel 4
Badge +17
I am not comfortable using JS so I would probably created a bunch of If statements in the survey logic. It might be a lot of work, but it is an in Qualtrics solution instead of going out of the box using JS.

Leave a Reply