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

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

  • 23 February 2023
  • 1 reply
  • 26 views

Badge +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

Userlevel 7
Badge +27

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