Give id to value of array

I have an array like [1,2,3,4,5,…]. I want to put it on repeat in a title field and I tried many combination in repeat but didn’t able to use it. Can you please help me with this.

I guess the issue is having no key within this array. How to add key is also another question to such an array.

The repeat functionality requires the elements in the array to be objects.

Luckily, we can convert this in-place with MAP – so if your array is in e.g. page variable myNumberArray, you can bind your repeat to:

MAP(pageVars.myNumberArray, {id: item})

This would then produce an array like:

[{id: 1}, {id: 2}, {id: 3}, ...]
1 Like

Thanks much! I spent 4 hours on this. Work of a second from your answer!

I want to now read that repeared value from another data variable, in the repeated value, which formulae should I use as formulae. Take “id” from this repeated current value and look it up to the an array where there is a field “name” to pick…

So if I got you correctly, you have a second array like

[{id: 1, name: "Banana"}, {id: 2, name: "Orange"}]

Now, you can either do it so that you bind the component property where you want to display name to a formula

LOOKUP(FIND(pageVars.secondArray, ===, "name")

or then just incorporate it in the original MAP:

MAP(pageVars.myNumberArray, {id: item, name: LOOKUP(FIND<secondItem>(pageVars.secondArray, === item), "name")})

The bad part is, it is an object.
{{id: 1, name: “Banana”}, {id: 2, name: “Orange”}}

You can’t have that type of syntax, so the object must have some sort of other structure – if you share it I can help you work with it.