Piped text in math operation not working properly | XM Community
Skip to main content
Solved

Piped text in math operation not working properly

  • June 16, 2020
  • 9 replies
  • 469 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?

Best answer by adstr

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.

9 replies

rondev
Level 6 ●●●●●●
Forum|alt.badge.img+22
  • Level 6 ●●●●●●
  • June 16, 2020

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


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • June 16, 2020

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.


  • Author
  • June 16, 2020

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.


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • June 16, 2020

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


  • Author
  • June 16, 2020

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).


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • June 16, 2020

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.


  • Author
  • June 16, 2020

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.


  • Author
  • Answer
  • June 16, 2020

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.


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • June 16, 2020

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.