MYSQL Insert Primary Key with Add Data Action

Alex3
New Member

Hello,

I am trying to insert use an action to insert a row into a MYSQL database table. In my specific use case, I have to auto increment the existing MYSQL primary key with the action. I think the topic in the Appsheet community link below indicates that a possible workaround is to use 2 different key columns.

Do this mean using two different key columns (.e. ID fields) in the MYSQL database?

Specifically:

  • One key column, the original database Primary Key
  • And the other key column, a database field specifically for Appsheet

For example:
Car_ID (existing Primary Key)

Car_ID_Appsheet (newly created field for use in Appsheet as the Appsheet UniqueID)

Using this approach:

  1. Will the Appsheet โ€˜Data: Set the value of columns in this rowโ€™ Action
    insert a new row to the database table, if the database Primary Key (i.e. Car_ID) is set to
    auto increment?

  2. Will the UNIQUEID() expression create a random value, for the Appsheet ID (i.e. Car_ID_Appsheet), that will be populated in both the database and in Appsheet?

Thanks,

Alex

Solved Solved
0 6 1,475
1 ACCEPTED SOLUTION

If you havenโ€™t already seen this:

If it conflicts with my suggestions, go with the doc.

Youโ€™d need to attach an action to the form view to perform a navigate to another view in such a way as to trigger a sync.

3X_7_2_723ca82df65d592a5a1c72d150165dc5a6d417c8.png

3X_d_8_d89aec691457a81cd7d9121a6256062500692186.png

View solution in original post

6 REPLIES 6
Top Labels in this Space