Auto Refresh Repeating Group Content

Hello,

How can I set up a repeating group data refresh?

Below is an image of my app, when I click the date/time picker and change the date, the RG refreshes to display that day’s meals. However when I change the date/time picker with the arrows, the RG does not update and stays empty. How can I trigger the RG to display the correct day’s data when changed with the arrows?

Thanks,
Nolan

What you’re doing should work fine if the RG is searching for recipes that match the date, might be worth double checking your expressions. Nothing too complex needed here

That’s what I thought as well… Except the RG isn’t displaying the entries when the date is changed via button.

Below is the expression I am using in the RG to search for the meals. Edition date is the value of the date/time picker when the meal entry was created.

Are your start and end date pickers separate? Post an image of your filters.

Perhaps a long shot since your first page seems to be working, but could it be that the timestamps are different?

You could try 2 constraints to test that theory (or just look at db but I can’t do that :smiling_face:):

Edition date >= date time picker:rounded down to day

Edition date < date time picker:plus days 1: rounded down to day

That’ll capture everything in the 24 hour window of that date (timezones are obviously a factor) and might help.

I added :rounded down to day in the RG search and it is now correctly displaying the meals associated with that day. Thank you!

Another question for you, the arrows will work to change the day but as soon as I click the date picker and change the day that way, the arrows no longer work to change the date. What do you think the issue is there? WF below

It looks like you’re trying to read from both the value of the date time picker itself and simultaneously a custom state. To use the arrows (and there may be a better way, but off the top of my head) you’ll want to transition everything to reading from your custom state instead.

I made a quick example here:

  • On page load set the date picker’s state to current date time
  • Change your search constraints to read from the state rather than the input itself
  • Make sure every click (icons and the date input) sets the state to the result
  • Wrap the date picker in a group (icons too for neatness)
  • Set the date picker’s default date to the state’s date
  • Every time you adjust the state date with the arrow icons, reset the group containing the date picker, that’ll reset it to whatever the state is, without resetting the state itself

I think I included all the requirements in there but it’s late so may have missed something, will weigh in again if it doesn’t work, as the one on my test page is working fine :slight_smile:

1 Like

Thank you so much!! This got it working perfectly.

1 Like

No problem, glad to help

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