Is there an easy way to get count of list in Repeating Group

Hi,

I am having a repeating group which is showing search results on basis of some search filters that are there in my application. In the repeating group, I have put “search for” constraints along with “advanced filter” to take care of “matching a list with another list”. Also, quite a bit of work is going on in “search for”.

Now, I want to display “Got n results” on top of the RG.

I tried using a custom state which would equal to count of RG’s list of elements. That didn’t work.
This is how I have done it.
Screenshot 2020-06-04 at 8.47.45 PM

Am I doing something wrong, or is there some other way of getting the count?

I can do the “search for” and “filter advanced” again to count this, but, that doesn’t sound efficient. Also, I am doing a lot of work in the “search for” and “filtered”, so I would rather keep it at one place so that I don’t have to modify at two places in future. Also, my text where I display “Got n count” is being changed conditionally with some text being added/removed depending on some conditions. So, I’ll have to put those “search for” etc. expressions at all those places. So, basically I won’t have just one copy of the expression, but about 5 of them.

Please guide.

Thanks,
Mukesh

That should be working the way you have it. To make it easier you don’t need the custom state. You can just put that Value expression right into a text element and that would work as well.

Thanks.

Somehow I didn’t realise it earlier that I could put the value expression in the text directly too.

Tried it just now and it worked. Not sure why the custom state bit was not working!

Thanks much.

1 Like

List… Count… this doesn’t work for me.

image

My repeating group shows zero items, however, the count shows 3. I added the count to a text field below the repeating group so I could troubleshoot what was going on.

The repeating group is looking for offices and then filtering by distance from current location. If I turn on my GPS, it will show the correct list of local offices. When I turn off my GPS so the search doesn’t find any results, they offices don’t show in the RG, but the count still says 3. Help!

I figured out what is happening. With GPS turned off, I think an exception is being thrown that crashes the RG, hence nothing shows, but the part that crashed was the filter, not the original item search, so the count is 3, but the component won’t paint.