Complex Data Handling in Custom States and Looping Workflows for Seasonality Data

Hello everyone in the Bubble Community,

I’m in the process of developing a feature in my application that involves capturing and processing harvest seasonality data for various agricultural commodities.

My goal is to extract numbers from input forms in a repeating group and subsequently create or modify records for each commodity based on the percentage harvested each month.

Here’s a detailed breakdown of my situation and the issues I’m facing:

Objective: I need to capture the harvest seasonality of each commodity. For each commodity, I want to track the percentage harvested per month.

Data Structure: I have a data type called “Seasonality” with the following fields:
• “% harvested” (field type: number)
• “Commodity” (field type: Commodity)
• “Month” (field type: Option Set Months)

Repeating Group Setup: The repeating group is set up with:
• Type of Content: Option Set Months
• Data Source: All Option Set Months (to create 12 rows corresponding to each month)


  1. Extracting Input Data: I’m finding it challenging to extract numbers from the input forms within the repeating group. I need to compile these into a list for each commodity.
  2. Creating and Modifying Records: I need to develop a system where:
    • If the parent group (commodity type) is empty, we create a new Seasonality record.
    • If the parent group (commodity type) is not empty, we search for the Seasonality record (where the Commodity type matches the Parent Group’s commodity type) and edit the Percent_Harvested.
    This seems to necessitate two looping backend workflows—one for creating and one for editing the Seasonality records.

Attempted Solutions:
• I tried setting up custom states to capture the indices and the percentages, hoping to pass them to the backend workflows, but have struggled to maintain an index for the months. I have tried to set us one independent Custom State for each input: OS Month, Percent_Harvested and Commodity; and also tried to generate a more complex Custom State: S Commodity SeaonAlity using Seasonality as the Data Type to try to capture all three variables at the same time.
• I’ve attempted to use “Schedule API Workflow” but have trouble capturing the data inside the inputs within the repeating group.

Specific Questions:

  1. Can we create a custom state that encapsulates a full “Seasonality” record (including all three fields) at once?
  2. How do I ensure that the custom state is capturing a list of values from the inputs instead of just one value at a time?
  3. What is the best approach to set up a looping workflow to handle the creation and modification of Seasonality Records based on the data captured from the repeating group?
  4. How do I address the problem of only capturing one percentage at a time in the custom state S Commodity SeaonAlity instead of compiling a list?

I’m currently at a standstill and would greatly benefit from some guidance or insights on how to resolve these issues. I have included screenshots of my current setup below:
I am looking forward to your suggestions and thank you for your support!