Get object id for nested repeat item

Hi, I am using xano as backend database.
I have attached an image of sample data retrieved from xano

I have created multiple container to do nested repeat. It’s work perfectly but from the lastly repeated container I cant access other object ID/index number
example :
This is what I can find in formula (current repeated )
image

my intention is to know the index of zero because I want update some information to specific to selected index in xano
data.Orders[0].items[0].Foods_List[0].multiple_addons[0].choice_title[0].choice_title

Hi, you can access the index info of each repeat level with the repeatedInfo namespace: repeatedInfo.nameOfRepeat.index

Example

Let’s say you are repeating with the list

[{id: "first", items: [{name: "apple"}, {name: "banana"}]},{id: "second", items: [{name: "kiwi"}, {name: "strawberry"}]} ]

The first level repeat is named first and second level as items.

The items (2nd level) repeat content is bound to a formula: "name: " + repeated.items.name + ", part of ID: " + repeatedInfo.first.index

This is what you get in preview:

Hi @Mari! Thank you so much for this useful guide. I had successfully get all my repeated data but I am trying to get ID of my each repeated variable. As the below image, I repeated the containers and not the paragraph.

Screenshot 2022-02-23 233147

I had given some colors to differentiate all my 5 nested repeated variables.

Black is the main container which linked repeated with data variables.

Red is second container which link with repeated current.items.

Green is third container which link with repeated current.foodlist

Blue and purple are the fourth and fifth containers which link with repeated current.multiplechoice and current.singlechoice.

Example

As the image above, My order table probably in this flow. For example, Under ID5 I have 2 objects and array of objects, and under that array of objects, I have 2 array of objects and 1 object and finally under that 2 array of objects, I have my final objects. I’m stuck when I am trying to UPDATE the last object. and that’s why I am trying to find these ID’s. Maybe I might doing this in a wrong way. Could you please help me with this problem?

Hi, you can find the lowest level object with a syntax like:
data.orders[repeatedInfo.current.index].items[repeatedInfo.item.index].multipleChoice[repeatedInfo.multiplechoice.index]

Then you can use the SET_KEY formula on the object to set a property. :slight_smile:

Hi @Mari! I tried the method that you said. I still can’t get the value. Maybe I’m doing it wrong. If possible, can we arrange a short meeting? So, I can show you the problem or can I send my app ID? I am seriously stuck in this part and I need to finish this project as soon as possible. Meanwhile I can learn a new method from this issue. Thank you and sorry for bothering you a lot :pray:t5:.

What’s your app ID and which page is the logic on?

It’s 331771 and the page name is 2.1 Order screen (at url it’s pages/4). This page take a bit longer to load the preview.

I took a look at the app, and the problem is that you haven’t named the repeats but are repeating every level as current. You need to give a unique name for each repeat in the “Repeat as” field to be able to access the different levels with the repeatedInfo.repeatName.index syntax.

Hi @Mari! Finally, Thank you so much. It’s working perfectly. I learned a new trick as well. Thank you :smile:

1 Like