Adding up to randomly generated numbers in a question | XM Community
Skip to main content
Solved

Adding up to randomly generated numbers in a question

  • December 5, 2020
  • 2 replies
  • 17 views

Hi, here's an example of what I'm trying to do:
At age ${rand://int/17:20} Mr. XXXX XXX-XXXX met Ms. YYYYYY YYYY. They were married for ${rand://int/30:40} years. He is now *1st number + 2nd number*
How do I create the 3rd number to be the product of the 2 previous numbers? thanks!!!

Best answer by TomG

One way to do this would be to assign the random numbers to embedded variables in the survey flow in advance (e.g.,

age = ${rand://int/17:20}
), pipe them into your question text (e.g.,
${e://Field/age}
) and use a math operation to add them together (e.g.,
$e{ e://Field/age + e://Field/married }
).

2 replies

Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • December 5, 2020

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • Answer
  • December 5, 2020

One way to do this would be to assign the random numbers to embedded variables in the survey flow in advance (e.g.,

age = ${rand://int/17:20}
), pipe them into your question text (e.g.,
${e://Field/age}
) and use a math operation to add them together (e.g.,
$e{ e://Field/age + e://Field/married }
).