Math operations with loop & merge field data (or embedded data) | XM Community
Skip to main content

Math operations with loop & merge field data (or embedded data)

  • February 23, 2023
  • 1 reply
  • 53 views

Forum|alt.badge.img+1

Hi,
I want to perform maths operations with loop and merge field data. For simple arithmetic, I can write say: $e{ ${lm://Field/2}+3}. But I want, say, the maximum of loop and merge field and an embedded data field:
max(${lm://Field/2}, $e{ e://Field/word + 3 }). How do I implement something like this? I am not good at Javascript, so if it requires custom code could you please provide the code as well? Thanks in advance!

1 reply

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5929 replies
  • February 24, 2023

There is no max function in Qualtrics Math operations, so you'll need to use JavaScript. In JavaScript, it would be:
var val = Math.max(Number("${lm:/Field/2}"),Number("${e://Field/word}")+3);


Leave a Reply