I’m not looking for a specific answer (although one would be welcome) but more of the right direction or approach for something like this. A specific plug in? do I need to upgrade to a paid plan to get access to database triggers or back end workflows to do bubble iteration?
In my app I have Type “Item”
- Quantity (number)
- Rate (number)
- Total (number)
- SubItem (Item)
- NoOfParents (number)
The goal is to allow an item to have many subitems, and subitems to have their own subitems etc.
Think of it as list of materials (prices) to build something
-Car [qty 1] [rate $300] [total $300] [Parents 0]
-----Wheels [qty 4] [rate $25] [total $100] [Parents 1]
----------Lug nuts [qnty 5] [rate $1] [total $5] [Parents 2]
----------Rubber [qnty 10] [rate $2] [total $20] [Parents 2]
-----Doors [qnty 2] [rate 100] [total $200] [Parents 1]
----------Window [qnty 1] [rate $10] [Total $10] [Parents 2]
----------Remaining [qnty 1 [rate $90] [Total $90] [Parents 2]
The plan is to have the rate of an item equal the total of its subitems, and then multiply by its quantity and set its parent rate to the result etc… (mulitply by quantity, add to the total etc.)
And do this anytime a number changes (planning to have most as user inputs)
I have it working with ListShifter, but not consistently. Unfortunately the debugger stops when it gets to ListShifter, so I can’t follow where the process drops off.
When an input value changes, I iterate through the parents to get a list of items that are affected, and then iterate the change on the first, apply the results to the next, etc. and then iterate an update to the database with all the new values for the items affected.
The problem is that sometimes it works flawlessly and others not. I’m using custom states but suspect (hope) there is a more robust way to do this.
Anyone here have experience with computations that iterate and are interdependent? Would love to hear what you found worked and what you recommend avoiding.