Math operation from text entry piped text | XM Community
Solved

Math operation from text entry piped text

  • 31 March 2020
  • 9 replies
  • 386 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!
icon

Best answer by TomG 31 March 2020, 23:36

View original

9 replies

In case someone else in interested, I solved it by dividing it into two parts: !
Userlevel 7
Badge +27
In your original you needed a space between ( and q AND between 2 and )
Great, thank you TomG!
Badge +9

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

Userlevel 7
Badge +27

@KWigg,
You can use the round function in an expression: https://www.qualtrics.com/support/survey-platform/survey-module/editing-questions/piped-text/math-operations/#AvailableOperations

Badge +9

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

Badge +9

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?

Userlevel 7
Badge +27

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

Badge +9

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

Leave a Reply