Random unique id

It would be cool for seatable not only offering automatic increment ids, but also a random unique id: either a number, a uuid, or base16 / base36 strings.

Would you specify this request? What is this ID for? For a user’s identification, for a base, a table, or a row?

Every row has a unique id stored in _id field already.

How can the _id field accessed/displayed?

I’ll try to formulate it better: an id string could be generated per row, but not of the auto increment kind currently offered by the “Auto number” field, but a random string id.

Random ids are nice because

  • they do not convey a meaning of order, hierarchy, or any meaning at all;
  • they make it possible to merge different tables without existing ids changing;
  • they can serve as stable identifiers to reference items in other systems, for instance storage.

Some random id examples:

  • r0njN
  • Kyp4v
  • rycN1
  • t93FQ
  • dPg6c
  • m3Vyx

classic random UUID
bdda68a2-9af7-11eb-afdc-ffc012920d0f

It can be accessed via row["_id"] in scripts, but can’t be displayed in the UI.

A practical work-around would be, let the script write each row’s ID into a column.

For example, you can use this following script for Table1, Default View:

const rows = base.getRows('Table1', 'Default View');

for (let i=0; i<rows.length; i++) {
    base.modifyRow('Table1', rows[i], {'row_id':rows[i]._id})}

So each time you run this script, it fills the column “row_id” with each row’s ID:

2 Likes

Thank you @Karlheinz this is a nice workaround!

It would be great if the random string _id would be available in formulas to avoid having to run scripts, or having to write a script that needs to work with all the different tables or column names of a base.

You are welcome!

Just curious: Why would you need to use the _id in a formula? What is it exactly you want to implement?

Having the id available in a formula would allow me to avoid having to use a JavaScript to work with simple cases. My specific use-case is that I am referencing files in an other system than seatable, and am using the id as the file name. That allows to create a link from a table row to something like https://myfiles.com/vault/{id}.pdf or similar. (My actual use case is directories.)

Mee too supporting this request: a random UUID available as a formula would be really useful.