Using Piped Text in a Retake Survey | XM Community
Solved

Using Piped Text in a Retake Survey

  • 26 February 2019
  • 4 replies
  • 17 views

Hello all,

I seem to have gotten myself into a pickle and want to know if there is a way to solve it without remaking the entire survey. I have created a survey that is designed to be taken three times. This has been accomplished with retake links distributed by email trigger. In order to not change any answers that were previously submitted, either purposefully or accidentally, I have used display logic to hide previously submitted questions depending on a question selected at the beginning and if the Q_URL contains 'Q_R' denoting that it is a retake. This means that it will show certain questions on the initial submission of the survey and then hide those questions using display logic and show new questions in their place during retakes. I have also used piped text in order to display the original answers onto the new questions, allowing users to reference their previous responses when filling out the new questions.

However, this piped text is not showing up on the displayed questions during retakes. I have checked and verified that the piped text references and retake URLs are correct as well as the original answers being on the survey. When the display logic is removed from the original questions, the piped text appears as intended in the new questions.

Is there a way to show the piped text while keeping those questions hidden during retakes?
icon

Best answer by jglidus 26 February 2019, 20:11

View original

4 replies

Hello @jglidus ,

We need to hide the question using JS rather then display logic.

Here is the code to hide the question in retake link.
Paste the code in the js(OnReady) of the question.

if(("${e://Field/Q_URL}").indexOf("Q_R") != -1){
jQuery("#"+this.questionId).hide();
}
I hadn't considered java to circumvent display logic. Would it work for questions that rely on more than one argument? What would the code be for that?

For example, this question will be hidden if this is a retake submission ('Q_R' in Q_URL) and someone answered a multiple choice dropdown question a certain way (QID=5.3 and answer=April).
> @jglidus said:
> I hadn't considered java to circumvent display logic. Would it work for questions that rely on more than one argument? What would the code be for that?
>
> For example, this question will be hidden if this is a retake submission ('Q_R' in Q_URL) and someone answered a multiple choice dropdown question a certain way (QID=5.3 and answer=April).

Then we need to write full display logic in js
Thanks for your help Shashi, I will look into how to get the Javascript to run properly.

Edit: Eureka! I was unsure about how the variables worked, but I figured it out anyway. For anyone out there looking for this answer, the code basically looks like this:

if(("${e://Field/Q_URL}").indexOf("Q_R") != -1 && "${q://QID73/ChoiceGroup/SelectedChoices}" == "February"){
jQuery("#"+this.questionId).hide();
}

*QID and "February" are dependent on what QID and answer you are referencing. Use piped text for the best result.

Once again, thanks Shashi for your help, I really appreciate it!

Leave a Reply