Creating a Form with Repeating Group/List of Numbers and Writing it to the DB

I’m working on a page that is essentially a form, but I’d also like the entries to get written to the database.

On this page, the user can create a Plan. A plan is a collection of locations with a note on each location. A plan could be something like a Rainy day in Bend, Oregon, or a weekend in Santa Barbara.

I would like to give the user the ability to add as many locations/notes as they would like, but also allow the user to delete a location/note if they want to reorder their plan.

Current Workflow:

User adds a title, description, time, cost, and age range, and presses the Add Locations button.

When the Add Locations button is pressed, all inputs are added to a Data Type called Plans, and the first stop is added.

Tapping + Add Location adds a new Stop to fill out.

I think the solution may be fairly simple, but I’m having trouble populating the form in a repeating group so there can be as many stops as the user wants to add, but also writing each stop to the database and linking it back to the Plans DB.

Currently, the trash can button doesn’t work because I can’t figure out how to add each stop entry to the database.

I have a Plan Locations data type that links to the data type Plan, and it includes:

location - geographic address

note - text

Plan - Plan data type

The Plans data type also includes a plan locations field which is a list of Plan Locations data type.

Does anyone have any recommendations on how to do this? Even if I need to take a completely new approach?

From what you’re describing, this sounds like a perfect place to use a custom state

Would you mind sharing a bit more about how to make that work?
The order of the Plan matters (Stop 1 should come before Stop 2, etc.), and even using a recursive workflow, I’m not sure how to keep the order intact.

I also need to make sure that the corresponding note stays with the location and stop number.

So every plan location will have

Location name, Location note, and Stop number