Hi, I will make this example scenario as simple and clear as possible.
Let say you have Type recipe. Recipes have 3 fields. One, list of Type Ingredient. Two, list of Numbers(representing 2 apples, 2 potatoes, etc.). Three, Units.
An example Recipe looks like this in the database:
Number Units Ingredients
1,3,1 Tsp, Cup, NULL Salt, Butter, Pumpkin
(I realized after posting that you cant see the spaces above, so imagine it as if each list is in one box of the field/one cell in a spreadsheet. Numbers has a list of numbers in the cell, Units has a list of units in one cell, Etc Etc.)
So the first ingredient in this recipe would look like: 1 Tsp “of” Salt
As you can see, the first entry in a given Recipe’s Number and Units corresponds to the first Ingredient in that Recipe’s list of ingredients
My first question is what are alternative data structures I can use so that I can achieve having different Numbers and Units of Ingredients in different Recipes (this isn’t mandatory but may be to achieve part 2 of my question )
My second question involves repeating groups. I want to display and most importantly edit in each row of a repeating group something like this:
1 Tsp Salt Remove (or add search-add and search-remove groups)
3 Cups Butter Remove
1 Pumpkin Remove
So when I change the Units for example, I can just click a “Save” button and if its the 3rd ingredient in that Recipe, the 3rd Unit is changed. I am currently able to display the Number, Units, and Ingredients of a recipe in 3 separate repeating groups (each group’s type of content is Number, Unit, and Ingredient, respectively), so it looks like one repeating group to the user visually. However, if I take an ingredient out, I don’t know how to edit the lists of Units and Numbers.
Thank you for the time to read this and respond!