How to get value of looped field one loop before the up-to-date one? | XM Community
Skip to main content

In a question inside a looped block, I have to print the up-to-date value of a looped field, i.e.

${lm://Field/1}
and the value of the same field one iteration before. How can I access that previous value?

Are trying to display just a previous field and not the answer? Are using a randomized order in loop and merge? Are you using all of loops?
If you answered Yes, No, and No to those questions, you can then just add an additional field which holds the previous loop's value(s). Follow? If you answer anything else I don't know how you would do it without js.

  1. Field Value 1, empty

  2. Field Value 2, Field Value 1

  3. Field Value 3, Field Value 2

  4. Field Value 4, Field Value 3

So when you are calling in the questions: ${lm://Field/1} ${lm://Field/2}.


MSobotta thanks, yes, that's what I want to achieve and I got your approach by populating a new field with an offset. It's pragmatic and working! If anyone has a solution with javascript, I'm interested also.


Leave a Reply