Math operation with response and random number returning "Invalid Expression" | XM Community
Skip to main content
Question

Math operation with response and random number returning "Invalid Expression"

  • September 21, 2024
  • 1 reply
  • 43 views

Forum|alt.badge.img+1

I have defined an ebedded data random number at the beginning of the survey flow as:

After the questions block, I use the following code to generate a value that is equal to their  numeric answer at QID28 + a random share of this value:

$e{ q://QID28/SelectedChoicesRecode + ((e://Field/Random_Number / 100) * q://QID28/SelectedChoicesRecode) }

But I get ‘Inavlid expression’. What am I doing wrong? 

Many thanks

1 reply

Forum|alt.badge.img+1
  • Author
  • 1 reply
  • September 21, 2024

Update: The issue is that you have to put spaces between every math operator. The correct expression is:
 

$e{ q://QID28/SelectedChoicesRecode + ( ( e://Field/Random_Number / 100 ) * q://QID28/SelectedChoicesRecode ) }