Math operation from text entry piped text | Experience Community
Skip to main content
Solved

Math operation from text entry piped text

  • Mar 31, 2020 8:53 PM UTC
  • 9 replies
  • 627 views

Hi all, I have a matrix question, with one row and two columns, with a text entry form. In each of the columns I ask the responded to give a number (I set Content Validation --> Number). I want to calculate the average of these two text entries. In the Survey flow, after the block where I ask them about these two numbers, I write: ! Apparently the expression is not correct. When I write : ${e://Field/average} , I get {Invalid Expression}. I followed the "Math Operations" page provided in Qualtrics to write the embedded data expression. What am I doing wrong? Thank!

Best answer by TomG

In your original you needed a space between ( and q AND between 2 and )
View original

9 replies

  • Author
  • Mar 31, 2020 9:08 PM UTC
In case someone else in interested, I solved it by dividing it into two parts: !

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • Answer
  • Mar 31, 2020 9:36 PM UTC
In your original you needed a space between ( and q AND between 2 and )

  • Author
  • Mar 31, 2020 9:39 PM UTC
Great, thank you TomG!

KWigg
Level 2 ●●
Forum|alt.badge.img+9
  • Level 2 ●●
  • Apr 8, 2020 7:37 PM UTC

TomG I don't suppose you happen to know how I could force that calculation to show up with decimals? (Currency)


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • Apr 8, 2020 8:04 PM UTC

KWigg
Level 2 ●●
Forum|alt.badge.img+9
  • Level 2 ●●
  • Apr 8, 2020 8:07 PM UTC

Dangit, I even saw that part!! Wizard, indeed! You're my hero!! :)


KWigg
Level 2 ●●
Forum|alt.badge.img+9
  • Level 2 ●●
  • Apr 8, 2020 8:11 PM UTC

So, I believe that works, however, I need to force a '.00' on whole numbers. Can rounding do that, or do I need something else?


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • Apr 8, 2020 8:18 PM UTC

Unfortunately, there isn't a practical survey flow method of formatting numeric embedded variables. So, you'll have to do it in JavaScript with .toFixed(2).


KWigg
Level 2 ●●
Forum|alt.badge.img+9
  • Level 2 ●●
  • Apr 8, 2020 8:20 PM UTC

TomG Thank you - I've been looking into that, actually, just haven't gotten quite the right syntax. Appreciate your help!!