Summary of the Problem:
I’m trying to create a Parent child system in Glide where quantity at any level of the assembly hierarchy automatically cascade through its sub assemblies and then its further sub assemblies and components. However, I’m running into circular reference issues when trying to calculate cumulative quantities.
Lets say A is the assembly:
Qty of B in A: 2
Qty of C in B: 3
Qty of D in C: 2
Total qty of D should be 232 = 12, but currently when calculating quantity Qty through multi level hierarchy I am reaching to a circular reference.
Current Database Structure:
- Parts Table:
- Part_ID
- Part_Name
- Is_Assembly (boolean)
- Total_Quantity = Rollup of Total cumulative quantity from child parts table
- Child parts Table:
- Child ID
- Parent ID
- Quantity_In_Parent (user input)
- Parent cumulative quantity = Total quantity of parent
- Total cumulative quantity = Quantity in parent * Parent cumulative quantity
Challenge:
When trying to compute Total_Quantity in the Parts table based on the Child relationship and quantities, I encounter circular references. For example, a part’s Total_Quantity depends on its components’ quantities, which in turn depend on their usage in other parents