How to detect when a repeating group has changed?

I want to trigger a custom action when the contents of a repeating group changes. The repeating group is affected by a filter, with the RP contents changing in real time whenever one of the filters is changed. The custom action updates associated pins displayed on a Leafy Maps map.

But I don’t know how to detect for a change in the repeating group. Any ideas?

Thanks!

I don’t know if it works -
Since repeating group is affected by the filter, when filter value changes repeating group changes.
So capturing the filter value would solve this. E.g when Dropdown’s value is/contains something then do the action.

Please share if you find any workaround here, that would help others.

Thanks, I thought of doing that, but it seems convoluted with many filters and different custom states, I think. I believe I would need to create custom states reflecting the current filter and previous filter states, or something? I have about 8 filters with lists, text search and checkboxes.

I wonder if there’s a cleaner and simpler way.

You are welcome.
Let’s see if anyone else has something to say about this.
By the way what are you trying to detect in the repeating group. Any changes or detect changes depending on the filters value only?

I only need to detect changes coming from the filters really. The RP can be updated by other users in theory (adding and removing items, changing the location of the items), but this in practice won’t impact the user experience.

I think in this situation for detecting filter specific changes you will need to use different states as you mentioned above.

Hello @andrew36

Have a group of type yes/no, name it “var - has filter 1 of 10 changed”, build and expression into this group that evaluates if the filter input is empty or not. Do the same for the other 10 filters. Then, add one 11th filter that is named “var - have any of the filters 1 thru 10 changed?”, and build an expression like this “var1 is yes OR var2 is yes, OR var3 is yes … OR var10 is yes” (var1 is short for var - has filter 1 of 10 changed?).

Place all this vars in a popup that you never open. This way they will be added on page load and not disrupt anything in your page’s UI … but will function as expected.

Then have whatever action needed in your app to trigger if var11 is yes :slight_smile:

Hope this helps!

PD: I used 10 as the number just for clarity purposes. The actual number will be your number of filters of course.

Hi, thanks for that method, but for selection changes it wouldn’t work. E.g. Changing from red to green. Both would make the evaluation true. Are there any other ways?

Just jumping in to add my two cents. I’d recommend trying to follow these steps:

  1. Create a custom state on the page that stores a list of items matching the same data type as your repeating group

  2. When the page is loaded, set the value of that state to equal the value of repeating groups list

  3. Create a workflow from the ‘do when condition’ is true event. The condition should recognise when the repeating groups list of items is not the same as the list of items in your custom state. This would mean that a change has been made to your repeating group list

  4. Within this workflow, run your event to update your map markers, then add an additional step that updates the value of the custom state to store the new repeating groups list of items

I haven’t tested this on my end, so there might be something I’m missing here. Hope this at least helps point you in the right direction.

4 Likes

This sounds very promising, thanks, but I currently don’t know how to check if the custom state is different to the repeating group!

And now I’ve worked that part out, so it all works now :slight_smile:

1 Like

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