Conditional Formatting of Piped Text? | XM Community
Skip to main content

I am trying to build a survey in which participants will play the popular game Wordle.

To summarize the rules, players have six attempts to guess a five-letter word. After each guess, the letters that are in the right place will turn green while letters that are in the word but belong somewhere else will turn yellow. So for example, if the correct answer is STUDY, a guess of GUIDE will have a yellow U and a green D.

I currently have my survey set up as follows: Question 1 is the participants’ first guess on Word 1. Question 1 includes 5 form fields labeled First Letter, Second Letter, etc. After participants guess, it advances to Question 2 where they will try their second guess on Word 1.

I have successfully pulled in the letters from prior guesses using Piped Text, so on Question 2 they will see a table populated with:

${q://QID1/ChoiceTextEntryValue/1} ${q://QID1/ChoiceTextEntryValue/2} ${q://QID1/ChoiceTextEntryValue/3} ${q://QID1/ChoiceTextEntryValue/4} ${q://QID1/ChoiceTextEntryValue/5}

 

My issue, however, is that I can’t seem to find a way to conditionally format the Piped Text so that the letters will change colors accordingly. Using the STUDY example, I feel that there should be an if/then statement like

“if ${q://QID1/ChoiceTextEntryValue/1} = S then green, if ${q://QID1/ChoiceTextEntryValue/1} = T, U, D, or Y then yellow, otherwise no color,”

but since I’m brand new to Qualtrics I’m not sure if this is doable. I would also be open to using bolded or underlined conditions rather than colors for accessibility and practicality reasons.

Thanks!

Hi @AlexAZ ,

You can achieve the same by encapsulating the embedded data into a div with unique ids .
And then run JS code to perform the logical operation and update the CSS of div element based on it.

Hope this helps😊!!!

 


Leave a Reply