Question about the repeating group

Hi, I have two questions about the repeating group:

  1. I want to display in a repeating group only “stories”, which are created in the current week. When a new week starts, the repeating group should be empty, until new stories are posted. Does somebody know how to do this?

  2. A story can get likes and I want to sort the repeating group by “Liking user” (it’s a list of users in the database) and the story with the most likes should be at the top. But when I want to sort the repeating group, the field liking user isn’t displayed. (See picture at the bottom) Does somebody know how I can sort it by liking users?
    image

Best wishes
Jakob

Hi there, @Jakob1… for #1, try adding this constraint to the repeating group’s search.

As you have already seen for #2, you can’t sort a repeating group by a field that isn’t on the associated data type. So, if it was me, I would likely add a field to the Story data type that I could use to sort the repeating group. The field could be a simple count of whatever your “Liking user” thing is or it could be a list, but that’s probably the way I would go.

Hope this helps.

Best…
Mike

1 Like

Ok, thank you very much :smiley:

1 Like

Hi, everything went out perfectly, but know it’s Sunday (I live in Austria) and the repeating group is already empty. Actually it should become empty on Monday. Do you know the reason for that? I did the same setup like you (see picture at the bottom)
image

Best wishes
Jakob

The reason for that is because Sunday is considered to be the first day of the week in Bubble (it is day 0 and Saturday is day 7). Try this…

1 Like

When I try this, nothing is displayed in the repeating group, not even a story, which is created one second ago

Ah, my bad… unless I am missing something simple (which certainly could be the case), it’s actually a bit more complicated when the day is actually Sunday. I made an example that conditionally changes the repeating group’s data source as follows, and it appears to work as expected.

Want to give that a shot?

1 Like

Thanks, I’ll try it out :smiley:

Thank you very much, it works properly :smiley:

1 Like

Hi, now it’s Monday, 2am and the repeating group still contains every story and isn’t empty. I think I did the same setup like you (see pictures at the bottom), but maybe I made a mistake. It seems like a never ending story :sweat_smile:
Do you maybe have a clue, what else could be done?
image
image

Best wishes,
Jakob

I have tested that setup pretty well on my end, and it appears to work as expected. If you want to send me a link (privately) to your editor, I can take a look at your app.

1 Like

Ok thats funny. I made a copy of my app with the same database and changed nothing to share the link of it. I previewed the copy and now everything worked! Than I got back to the original and it didn’t work. So I made a copy of the repeating group in the copy and pasted it in the original and now everything works out (so far :joy:)
Very strange, but the main thing is that it works :smiley:
And thank you for your patience:)

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.