Parent and Child Table Relationship

Hi,

I’m completely a newbie in Glide with no coding background at all so I hope I don’t ask a silly question.

I have 2 tables, 1 acting as a Parent and 1 as a Child.

Columns in Parent table are like this:

Date of Purchase, Supplier Name, Items, Price

And columns in Child table are:

Supplier Name, Phone Number, Address

My question is, is it possible to input new Supplier Name from Parent table and make a new row in Child table with other columns beside Supplier Name is empty? User can then fill the empty columns in Child table after completing filling the Parent table.

Thanks in advance for all the answer.

Possibly…

Assuming you are using a native glide form, you could add an On Submit action that adds an extra row to the child table, but it will need to be a custom action, and it would need to check if a child row already exists for that supplier or not. That’s where it gets a little more complicated and fragile. I prefer using a custom form at that point. You would still need a custom action on a submit button with conditions to add rows to both tables or only one table depending on if a supplier row already exists in the child table.

1 Like

If OP doesn’t want a custom form, I would suggest a choice component for the form writing to the “Parent” table, listing all existing Supplier Names.

If the Supplier Name doesn’t exist, have a form button inside that Parent form to add a new Supplier.

1 Like

Exactly what I’m thinking.

I would make a relation of Supplier Name from Child to Parent and use the Choice component. Instead of showing “—” the Choice will show “Add New” and create a new row in the Child table.

But I still don’t know how to do that.

You can’t have an “Add new” option like that. It has to be a separate button.

Is this button made using action?

I’m still learning how to use action.

Yes, it is a form inside a form. Add an open form action right below your choice component, using the same example above.

I’ve added a button and set the action to Set Column Value to the Child table. But the button suddenly doesn’t show on the screen.

What did I do wrong?

The action on the button should be ‘Show Form Screen’.

The Show Form Screen action shows the form screen from the Parent table.

How can I make a form screen show from the Child table?

@ThinhDinh is saying to add another form button inside of your form. So you would be opening a form within a form.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.