PRIMARY KEY, please Help me!

I set a column as PRIMARY KEY, but when I create a record that column is invisible and the value is empty

Is there a way to auto generate the value for the Primary Key column ?

In Appsheet there’s a function named UNIQUEID() that create automatically a unique code to use as id column

Can you please specify which resource you are using? In the case of SQL resources (PostgreSQL, MS SQL, MySQL, etc.) you can configure Primary Key in the table schema as well as autoincrementation function (if it is id=1, 2, 3 …) or uuid/guid generation. In this case Jet Admin will not generate primary keys for your data.

The same applies to Firebase, Airtable and other resources, where the id is generated on the resource side itself.

For example, for Google Sheet, the primary key is the row number.

So my questions are still valid:

  1. What resource are you using?
  2. Why do you need to change the primary key (if it is defined automatically)?

I see that you are using the Google Sheet resource. Whenever you deal with parameters, we display which field is the primary key (in GSheet case it is the row - the ordered number of the row):

Hi ! Thanks a lot for your support.

Setting Row column as primary key is not a good chance, because if I create a second dependent table with a link-to-row column and I delete a record from the first table I lose the correct correspondence in the second table.

FIRST TABLE
Row,ColumnA
1,FirstValue
2,SecondValue
3,ThirdValue

SECOND TABLE
Row,LinkToRowColumn,ColumnA
1,2,FirstValue
1,1,SecondValue
1,1,ThirdValue

Now, if delete the Row n° 1 in the first table the LinkToColumn in the second table will have the incorrect referred row value.

Why then do you use Google Sheet to implement such a data structure? As for the question about generating UUIDs, for example, there is no such feature at the moment, but we will implement it in future releases.

I use Google Sheets because I created in the past a Database with it and wouldn’t change it, but If there is no solution I will change data structure for sure.

For example in APPSHEET there’s a function named UNIQUEID() that create automatically a UNIQUE ID for a column

I just discussed this functionality on the sprint planning call with the team. We will release a new UUID() function available in formulas to generate a unique key this week.

Wooooow !!! :+1:t2::clap:t2:

Top, thanks a lot!

New function UUID() is released:

Yeahhhhhhhh !!! It’s a good news !!!

Sorry, but it doesn’t work…it writes an infinite loop code…

look at the video

After click the Submit button :

1 - It does not return an alphanumeric code
2 - It does not create a unique key, because it returned 3 times “1” as a unique code

Take a look, please: Loom | Free Screen & Video Recording Software
You are doing something wrong as UUID() cannot be a numeric value.

This is how it should work :slight_smile:

I used it in a wrong way. Not in the submit button, but in the value field of the form.
Thanks a lot!!

By the way, it does not matter, you can use it anywhere, but it is not good practice to display UUID() when creating a record. That’s why all primary keys are hidden at creation and generated automatically.