Generate unique number for each entry

Hello! Long time Seatable user.
Now implementing it in a company I started working in, for document list. Everything is going great but we have one step that we cannot get over, thus me coming here to ask for help.

Setup currently: Based on selections from multiple columns a name is generated(by using concatenate etc), and that works well, but we also need to have a unique number at the end of the document name, example name Test_doc_type001. The 001 is a sequence number based on how many counts of “Test_doc_type” documents we have, for example, if we have three documents named “Test_doc_type”, one will have 001, another 002, and last 003(which is asigned to which is not necessarily important).

In excel we did it manually - have a column that counts instances of the same document name and added the number manually. But we would like to generate it, so a new document can be added with forms and automatically generated the 001 or 002 or w/e.

What could be our options? Pyhton or json and run it often? How could that be done so that it automatically then gets generated when a new line is added?

Thanks for any input!

Welcome to the SeaTable forum.

Have you tried the auto number column type?

Based on your description, this could work:

  • Add an extra auto number column to your table
  • Modify the concatenation formula in your formula column
  • Check if this works

Sure, there are also more complicated ways. You could add an automation with “new record” as the trigger event. The action could then be a script that generates a 7-character alphanumeric string which should – for all practical purposes – be unique.

Thanks! But the problem isnt unique number but the fact we need unique number for every file with same name not globally. Fx. Lets say the only document currently is called Test_document001. If you add a new document is Test_document as well it would be named “Test_document002”. After that if I have a different type of document, for example a picture, it would be called “Test_picture001”. Etc.

I am looking to identify and number each different combination of _ and add the number per specific instance.

In reality this is much more complicated, but rest of the stack I have working, only numbering is the issue.

I am not sure I understand. SeaTable does not name files and SeaTable does not support renaming files saved in a file column. (And how did you do this in Excel?) A more concrete description would be helpful.

For your serial question, this is how you could automate it:

  1. Create a script which contains a counter for one document type (i.e., test_document) - every time the script is invoked, the current value of the counter is written into a cell of the triggering row and then the counter is incremented
  2. Create an automation which executes the script as an action; the automation’s filter rule is that the a record is modified and the counter’s document type create in 1. is used
  3. Once this works, you can replicate the scripts and automations for any number of document types you may have

Sure, you could also do this with one script. Depends on the number of document types you have. My approach has the advantage that you do not have to programmatically tell the different document types apart. The automation’s trigger rule does that for you.

Sorry, I wasn’t clear.

By file/document I dont mean actual file, just a text value in a cell. That cell value is what we use to name a certain document(and that is done manually, which is fine), my bad explaining the situation.

A simpler example. would be a list of documents that would look like this:
A01
B01
C01
A02
A03
B02

The numbering is based on how many “A”, “B” and “C” exist. And I would like to generate automatically the values that follow the letter.

Then, this

works.

Disadvantage, you need to upgrade to the enterprise subscription for automations.

Thanks! We are planning to get the enterprise subscription anyway!

1 Like

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