Need some help with showing list inside list ( repeat inside repeat )

Dear, I’m trying to make a “repeat inside repeat” : list of days and each day has some activities.

The logic and flows I think I did right, the problem must be in the showing part. I keep the same logic and flows, just change the the component and layout :

ACTIVITIES list will show correctly if I put it out of container EACH DAY ( It’s mean only activities separately, without days ) But if I put it inside, nothing will show at all…


1 Like

Without more information (screenshots of logic flows and visual elements) this is hard to diagnose, but my first suggestion is to make sure that in your logic flow, you are loading the data for the Activities before you load the data for the container (Each Day). Right now nested repeated elements will not show updates unless the top-level repeated element is also updated (e.g. by updating the variable that Each Day is repeated with).

I’m not sure if this will solve your problem but I hope it helps!

Thank you ! But it couldn’t help :frowning: It’s not relate to the order of loading data because I load all of it with one Create Record flow. Maybe it just hasn’t fully support right now for the React Native and our Composer Pro.

Hi! Something that’s important with nested repeats is that you name the repeats. By default the repeat is named current, but when you have two repeats going within each other, that gets confused. You can name the repeat from here:

Fingrid_Töiden_Hyväksyntä___Composer_Pro___platform_appgyver_black

Note that after renaming the repeats you have to fix all the bindings inside of what you are repeating to the new bindings.

3 Likes

Woww, I got it, help me out alot, thank u so much !

@Mevi I am setting up a similar nested repeat but I’m missing the piece of how I filter what is shown in the nested repeat with a value from the parent repeat? Can you help?
Tks

You can filter the nested repeat in two ways: either you make what you repeat (inside the outer repeat) a SELECT formula that filters the nested repeat data (this currently prevents using input fields etc. in the repeat), or you hide the ones you don’t want shown with the visibility property of the inner repeat container/component.

1 Like

This was very helpful and solved most of my problems related to nested repeated lists. Currently I’m stuck with an use case where I need to delete a record from the child repeated list, which I named as “reply” instead of current. I’m using the logic to set the current document I’d to a page variable and bind it to reply.name from the child repeated list. Unfortunately the page variable is showing as blank in debugger.

The exact same logic worked in the parent list (current). I only used current.name instead of reply.name.

Am I missing something here? I’ve used the reply repeated list fields extensively in the app and no other issues encountered so far.

I’m not sure if I understood your situation correctly, is this your structure? You have a list-type data resource on the page, “documents”. Within “documents”, you have a property that is of list-type called “replies”. You want to show a list of “documents” and show their “replies” in the same place, and then be able to delete a reply?

Out of curiosity, I built a test case similar to this. There was no problem in deleting the reply of a document (in my example, a “post”). Key to this is giving names to both repeats as described above. The formula I used to remove a reply from the document in the variable it was in (in my case, a page variable) was the following:

SET_ITEM(pageVars.posts, item.id == repeated.post.id, SET_KEY(item, "replies", REMOVE_ITEM<reply>(item.replies, reply.id==repeated.reply.id)))

Naturally, if you need to make calls to backend the method of deleting would be different. But you can easily access the id of the “parent” of the reply, in. my case the “post” and in yours the “document” if you have named both repeats, with repeated.document.id or repeated.post.id in my example.

I am using Firestore subcollections.

e.g: Users/UID/lessons/documentId

My GetLessons API Get Record Section:

https://firestore.googleapis.com/v1/projects/projectId/databases/(default)/documents/Users/{documentId}/lessons

Header key: Authorization ‘Bearer idToken’
URL placeholder: documentId

Schema:
documents[

  • fields: {*
  •         lesson_name: { stringValue: text },*
    
  •         lesson_category: { stringValue: text }*
    

]

on Lessons page:
Set Data Variable: GetLessons (Fill authorization and documentId)
List Item →

  • Repeat with: GetLessons.documents
  • Repeat as: documents
  • Primary_label: documents.fields.lesson_name
  • Secondary_label: documents.fields.lesson_category

This works perfectly.
I am open for any suggestions. Thank you in advance.