Piped text in math operation not working properly | XM Community
Solved

Piped text in math operation not working properly

  • 16 June 2020
  • 9 replies
  • 233 views

I've been messing around with the math operations in Qualtrics and have repeatedly been treated with {Invalid Expression}. After some testing I believe it's from the piped text within the expression. For instance, I set up this very simple survey:
Screen Shot 2020-06-15 at 6.40.34 PM.pngI've tested the survey by using the 'Preview' button and have input numbers like 1 or 2 or 3 into text box for Q1. I've also tried changing the validation to make sure whatever entered is a number. However, the expression in Q2 always returns {Invalid Expression}. Is there something wrong with my syntax?

icon

Best answer by adstr 16 June 2020, 23:11

View original

9 replies

Userlevel 7
Badge +22

Just do the math operation in the survey flow and store result in embedded data and then pipe it(embedded data) in the question.

Userlevel 7
Badge +27

adstr - Your syntax works for me (the only difference is I set Q1 content validation to number). Did you use "Piped Text" to pipe Q1 into Q2, then modify it? I'm guessing that maybe Q1 isn't QID1.

TomG Yes that is exactly what I did. I even deleted what I had and used "Piped Text" again to see if Q1 isn't QID1 but it is. I still get invalid expression.

Userlevel 7
Badge +27

https://www.qualtrics.com/community/discussion/comment/26808#Comment_26808Strange. You can try copying what worked for me:
$e{ q://QID1/ChoiceTextEntryValue + 1 }

https://www.qualtrics.com/community/discussion/comment/26809#Comment_26809I copy-pasted... still no dice. I'm doing this on a mac; I'm going to try to do it on windows (even though I don't think it should matter).

Userlevel 7
Badge +27

It shouldn't make any difference, but one other thing I did differently was put both questions in the same block with a page break in between.
It should definitely work, so maybe you should contact Qualtrics Support.

https://www.qualtrics.com/community/discussion/comment/26811#Comment_26811Yep, I tried putting them in the same block with a page break in between. Still get {Invalid Expression}. I'll contact support.

I contacted support and found out that the html got jumbled up due to the way I was typing (it took us 20 minutes to figure that out). I first typed "$e{ " then input the piped text. However, the way it should be done is to first input the piped text, so you get "${q://QID1/ChoiceTextEntryValue}" then put an "e" between "$" and "{", and include spacing where necessary. This makes it so that the html syntax is how it should be. This is how I got it to work. Disappointed to how finicky that is.

Userlevel 7
Badge +27

https://www.qualtrics.com/community/discussion/comment/26822#Comment_26822The lesson is use HTML View when you need to be precise. Normal and Rich Text do some funky things.

Leave a Reply