Hi all. I have a complicated issue that I cannot resolve and I could not find anything similar to in the forum.
Background:
I have some user data. Lets say it looks like this:
DATASET 1
NAME GROUP
Data 1.1 none
Data 2.1 A
Data 3.1 A
Data 4.1 none
Data 5.1 none
DATASET 2
NAME GROUP
Data 1.2 A
Data 2.2 A
Data 3.2 none
Data 4.2 B
Data 5.2 B
Items in a group are displayed together. Because of this I have a nested repeating group.
- The outer RG group lists the DATASETs.
- The inner RG lists the Data.
- A Group can have 2 or more items and it is unknown in advance how many.
The user is able to select how many items from each DATASET to display.
For example, if the user wants to display 1 item, the result is:
DATASET 1
Data 1.1
DATASET 2
Data 1.2
Data 2.2
If the user wants to display 3 items, the result is:
DATASET 1
Data 1.1
Data 2.1
Data 3.1
Data 4.1
DATASET 2
Data 1.2
Data 2.2
Data 3.2
Data 4.2
Data 5.2
I can make this work if I hard code a condition for each specific variation. But that’s not a very good way to do this!
PROBLEM:
My problem is that after an inner RG contains a group, in the next cell of the outer RG I need to know which item in my list to start from. In my second example, the outer RG has these data counts for it’s inner RG:
Outer RG Inner RG Count
Cell 1 2
Cell 2 1
Cell 3 2
So how can I know in cell 2 that I need to begin with list item #3?
And in cell 3 I need to begin with list item #4?
I need a cumulative count of the number of list items for each of the previously nested RGs. In traditional programming this would not be too hard, but I cannot see how to get there in Bubble.
I’ve thought about using Run Javascript from the Toolbox, but that would require a workflow. I’m okay with that if it would work but I still don’t know how I can get those cumulative counts to a javascript that would be the same for every cell.
If you need any further clarification please let me know. I’m open to any ideas.
I did previously ask about this issue and received a decent reply from @romanmg but unfortunately that solution was not quite right. Gaby took my example literally and hard coded the option of viewing 5 by creating 5 RGs, but this is actually dynamic. I can’t know in advance how many items will be in the list or how many the user needs to show. This is why I’m embedding a RG in another RG. I just can’t figure out how to know where to pick up the list position after a group has been displayed.
TIA