Show array member using a variable

(Ernesto) #1

Let say that we want to iterate on the members of an array, and show each of them in a single message, for example {{result__0__member}} in the first message, {{result__1__member}} in the second one, and so on. What if we want to use a variable n and show the n-element only?, something like {{result__n__member}}. I found no way to do that ;( (Of course, we can use code for resolve the n-element, but I mean if there is some expression similar to {{result__n__member}} to grab the n-element.) Any help or idea would be appreciated :wink:

(Nathan Stults) #2

Hello,

That exact syntax is correct - you can index into an array with n, so

result__2__myproperty works, provided ‘result’ is in fact an array.

(Ernesto) #3

OK. If you put {{result__2__myproperty}} it shows the third element in the array, right? But I mean the case in which you do not know, previously, what element should be shown. That’s why I talk about a “variable”, say q. It would be good if we can use something like {{result__#q__myproperty}} and voilà! But I think that is not possible currently. So, the only solution seems to be using a CODE with var q as an input and the “q-element” of the array as an output.