Pulling data from specific cell holding dynamic value in Repeating Group


I’ve been searching the forum, but can’t find answer to this specific question.
I understand how to pull information from a specific cell in RP if that data is stored in a database (i.e. through RP’s item# and index). However, I can’t figure out how to pull data from a dynamic cell (i.e. input) located within RP.
In my case, I have a repeating group that pulls data from a database except for two fields (Amount and Balance). The cells in Amount field perform some calculations and store the result in an “input” element. The “Balance” field is calculated as “Opening Balance”+current cell’s “Amount” + previous cell’s “Balance”. What I’m struggling to accomplish is to access the previous cell’s “Balance” amount when it’s a dynamic value (i.e. stored in the “input” element and is not saved in a DB).

Any guidance or workarounds will be greatly appreciated!

1 Like

I haven’t done this exact thing before, but here are two approaches I would take to solve for it:

  • You can store values from within the cells in a custom state for the page (and set it as a list of things). Then, when you load or change the data, be sure to keep the list of things in the same order as the cells within the RG. Then, if you’re in cell 9 and want to reference cell 8’s budget, then create a dynamic query like: page’s custom-state-budget: item #: (current-cell-number minus 1).
  • Sometimes it’s helpful to make the content within the cell of an RG into a reusable element (RE). The reason for this is that you can run workflows within an RE’s and the workflows know which cell to reference (because it’s the current cell). This often opens up a new set of workarounds. For example, if you need to calculate the current cell’s number minus 1 (because you may not be able to do this directly in the same equation since bubble’s order of operations goes from left to right) you can run that as a workflow in a RE and save the result as a custom state (e.g., current-RE’s-previous-cell-number).

Best of luck!

Thank you for the prompt reply!

Could you please elaborate on the first approach? I’m reading the user manual, but I don’t quite get how to save data into custom states and then retrieve it. Should I create a custom state at the page level (i.e. group that holds all page content) or at that cell’s level (i.e. group that holds the “balance” elements)? Can you please walk me through the process of saving data and then retrieving it? I can share my test page if that’s helpful.

Thank you!

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