Condition for RG

Hello everyone,

I would like to do a condition on a RG, with this result :

It’s a comparison system, like a shopping cart. When there are less than 4 elements in it, I want the rectangle with plus icon to appear in place of the empty elements :

Problem : when I put the condition on the RG it makes this :

Here the conditions :

Anyone has an idea ?

Thank you !

Hi there,

Try instead: When Repeating Group’s list of items: count < 4

For the condition to be visible.

Unfortunately it doesn’t work.

This applies the condition on all the items of the RG.
I would like the condition to be individual to each element of the RG.

I tried with “current index” but it doesn’t work either.

Ok I think I understand what’s going on. Is it possible to instead move that element outside of the RepeatingGroup?

If not, make sure to set a minimum of 4 columns and 4 items on the repeating group, so that 4th cell shows up even if it’s empty.

And then I’d try some combinations on the condition:
If this repeating group’s list of things: count < 4 and current cell’s index is ≤ and current cell is empty: this element is visible.

2 Likes

I think @msgiblin is right. You should take the empty card out.

You can try an approach with a second Repeating Group for the empty card(s) and custom state type number that get updated on page load.

  • custom state update: 4 - RG list of items :count
  • RG data: an arbitrary text (1, 2, 3, 4) split by “,” items until [custom state]

With this technique you can scale your idea with more than 4 products without having to duplicate the empty groups and the conditionnals.

2 Likes

both solutions are correct, I once handled this by making the empty field the first one, but this is different. just put the empty group outside the RG, visible when RG list of items count < 4 and make sure its dimensions make it look as if it’s inside.
ScreenRecording2024-08-28at11.00.52AM-ezgif.com-video-to-gif-converter

2 Likes

Hello !

I tried with an other RG outside but i had a problem if i used the same data source : if i have 1 item, it shows only 1 empty card.

So i put the “empty card” outside (not in a repeating group), and i have the same result as @hanan1

Thank you for your advises !