Get total value from individual cells in a Repeating Group

I have a Repeating Group that is pulling data from an API. Within the Repeating Group, I am displaying their related posts data from another API by matching to their user ID. The structure looks like this:

Repeating Group: User
-- Group: Posts (hidden)
--- Repeating Group: Posts

None of the data is stored on Bubble, it’s all external.

You can see the live version here. This is my test app, so you can see the edits made here. Be sure to reveal the hidden group that you can find under the Elements tree.

I have an input field that is showing the count of characters. I want to get the total sum of the character count from all of the cell from the Repeating Group (Posts) and display it on the parent Repeating Group (Users).

I was thinking I can get the total character count from the Repeating Group by using the custom states, but I haven’t been able to create something that works. Any suggestions?

Try the following. Create a data field for your character count for each RG, call it “Char Count” (type is number). For “Total Character Count”, do a Search for your RG for each of the individuals, ie Leanne Graham and look for “Char Count” then include :sum. It would look something like this:
Search for Posts’s Char Count:sum
Make sense?

The API will load more data over time. So it wouldn’t make send to create a new data field for each new cell on Bubble. I rather not create a data field, would it not be possible to store the total sum in a custom state for the Repeating Group?

@ethan - I’m not sure if you can use a custom state to store the sum. Based on my use of custom states, it doesn’t seem like you can do that, but not sure.

I have yet to find a way. But I don’t mind storing in Bubble’s database as long as it’s not too complicated. From your original recommendation, it looks like I would need to create a bunch of fields equal the the number of cells available in the Repeating Group? If so, that won’t work because the data is dynamic. Some days will have more data, some will have less.

Perhaps you could use the group by function to capture this information?

Have run into this problem as well. No solution yet. Hopefully you find one, and update us.

@ethan - with @dan1 suggestion (thanks @dan1!) , I tried :grouped by and got it to do a char count across a repeating group. Check out the demo here (look at the content in the bottom square box)

Instead of regex that you had I did a char count.

Does this achieve what you’re looking for?


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