Need Help Syncing IDs Between MySQL and Glide Tables


I’m looking for a way to submit a Glide form where the values are saved in a MySQL table (let’s call it Table A). After submitting, I need to use the ID from Table A to create a new row in another table (Table B), which is a Glide table, not a MySQL table.

I tried to do this with a button action on the Glide form submission. While it successfully creates a new row in Table B, the problem is that the ID in Table A and the ID in Table B (which should act as foreign keys) are not matching. In other words, it’s adding a row in Table B, but with a different ID than the one in Table A.

If you use the Glide API to add the first row (using Call API, for example), the API response will include the RowID of the new row. You could then use that when adding the row to the second table.

For Table A in MySQL, I am submitting a form using a submit button inside a container. The ID of the MySQL table is set using a unique identifier in the button’s action attribute.

Okay, so you are generating your own unique ID.

What you could do is modify the action that opens the form so that it first sets a unique ID in a column in the User Profile row. Then use that same value to add both rows.

Yes, I believe I understand.

My suggestion is to generate the uniqueID before submitting the form and store it in the user profile row. Then use that same stored value in both add row actions.

How can a unique ID be generated without submitting the form? Currently, the unique ID is only generated when the submit button is pressed.

How do you navigate to the form?

Presumably with an action?
Modify that action so that it first sets the UniqueID using a Set Column Values, and then opens the form.

What you have there is different to what I suggested.

My suggestion is to set the UniqueID when the form is opened, not when it is submitted.
So your action sequence at the start should be something like:

  • Set Column Values → User Profile → Unique Identifier
  • Show Form Screen (or Go To tab, or however you currently open the form)

The way you have it above you are trying to do it all in a single action sequence. Chances are you are getting a race condition where the new rows are being added before the user profile value is fully set. By doing it as the form is opened, you eliminate that possibility.

oh, and by the way - you mentioned earlier that you are using a Form Container. A form container (or any type of add form) will add a new row when it is submitted. So if you are using an onSubmit action to add a row to the same target table you will end up with duplicate rows. Assuming the action you showed above is an onSubmit action, you should only be adding a row to the second table, because the first table will already have a row added through the form submission.

1 Like

Are you sure you aren’t adding two rows to the first table?


It is finally working fine now. Thank you very much! I have one more question: my unique IDs are mostly negative numbers. Is there any way to handle this?

What type of column are you using in the user profile row?

It should be a text type, sounds like you might be using a number type?

Yes I am using number type because my ID column in mysql is number type

I see. That complicates things somewhat. Does it have to be a number type? The easiest thing would be to change it to varchar.

If that’s not an option, then we may need to rethink the solution.

1 Like

Alright I will think about it, thank you very much for sticking with me until the end to find a solution to this problem.

1 Like

Is there a reason you don’t just show the form directly, but having to do this and then navigate the user to another tab?

Also, I don’t think you need to have a number entry with a default value. You can just set that value in the “Additional Columns” section on the right, no?

Can you tell me what the field is for the “2147483647” error you see on the screen? Is it the unique identifier you talked about above, or not?

Is it true that your “Unique ID” is alphanumeric, but your SQL ID needs to be only numeric?

In glide my unique Id column is number type and yes my SQL ID is numeric


Is it truly numeric though. I mean if you change that to a text, does that set a value that is alphanumeric?

I wonder if it’s only showing the numbers in an otherwise long alphanumeric string.

you mean to change the type in SQL database ?