Hi
I’m trying to create a basic app to track inventory of components.
Each component may require other components, thus creating a kind of dependancy-tree.
For example, lets say the “top level” component is a Car.
So i’d have four components.
Car
Wheel
Hub
Tyre
1 Car requires 4 Wheels. And each wheel requires 1 Hub and 1 Tyre.
I’m not sure how to set up the relations in Glide.
In a traditional relational DB i would have done it like this:
However, this gets complex when you want to know how many hubs and tyres would you need to make a car, for example, and if you have more than just 2 levels like this one. It might have to involve some sort of JSON manipulation.
Hmm, I expected to need to set some constraints on the table to do this linking.
Is it good enough to just rely on it being a text field without any validation and just rely on the front-end to ensure that valid IDs are inserted?
I would suggest checking this. You can either use a form button or a form container.
Your form would contain a choice component to add the child component’s ID, and a number entry for the quantity. Then you pass over the parent’s ID. If you’re on the details screen of the parent component already, it’s straightforward to pass it as a special value.