Generate unique id in specific format in app sheet

I want to create unique id in specific format like TASK00001.

whenever new task is created, system automatically create id TASK00002 and so on.

please help

 

Solved Solved
0 5 853
2 ACCEPTED SOLUTIONS

Hi , 

The most straight forward way would be this formula : 

IF(
[_THISROW].[_RowNumber] - 1 < 10,
CONCATENATE("TASK", "00000", ([_THISROW].[_RowNumber] - 1)),
IF(
[_THISROW].[_RowNumber] - 1 < 100,
CONCATENATE("TASK", "0000", ([_THISROW].[_RowNumber] - 1)),
IF(
[_THISROW].[_RowNumber] - 1 < 1000,
CONCATENATE("TASK", "000", ([_THISROW].[_RowNumber] - 1)),
IF(
[_THISROW].[_RowNumber] - 1 < 10000,
CONCATENATE("TASK", "00", ([_THISROW].[_RowNumber] - 1)),
CONCATENATE("TASK", "0", ([_THISROW].[_RowNumber] - 1))
) ) ) )

 

It's a shameful formula ๐Ÿ˜…

View solution in original post

You need to add a new column (not a virtual one), and you can use this formula inside your Initial value field and use it as a key column.

baba_sawane_0-1701071730315.png

If you don't know how to add a new column : In your database, create a new column for the ID (in my screen it's TASKID) : 

baba_sawane_1-1701071805875.png

 

Then go back to your app and regenerate the table using the refresh button: 

baba_sawane_2-1701071833464.png

 

 

View solution in original post

5 REPLIES 5

Hi , 

The most straight forward way would be this formula : 

IF(
[_THISROW].[_RowNumber] - 1 < 10,
CONCATENATE("TASK", "00000", ([_THISROW].[_RowNumber] - 1)),
IF(
[_THISROW].[_RowNumber] - 1 < 100,
CONCATENATE("TASK", "0000", ([_THISROW].[_RowNumber] - 1)),
IF(
[_THISROW].[_RowNumber] - 1 < 1000,
CONCATENATE("TASK", "000", ([_THISROW].[_RowNumber] - 1)),
IF(
[_THISROW].[_RowNumber] - 1 < 10000,
CONCATENATE("TASK", "00", ([_THISROW].[_RowNumber] - 1)),
CONCATENATE("TASK", "0", ([_THISROW].[_RowNumber] - 1))
) ) ) )

 

It's a shameful formula ๐Ÿ˜…

Thanks for your reply.

I am new to app sheet..Could you please tell where I need to apply this form.

when I apply on column level, I am getting this error.

"Key column 'Task ID' in Schema 'All Task_Schema' cannot use an app formula. The app formula will be removed."

You need to add a new column (not a virtual one), and you can use this formula inside your Initial value field and use it as a key column.

baba_sawane_0-1701071730315.png

If you don't know how to add a new column : In your database, create a new column for the ID (in my screen it's TASKID) : 

baba_sawane_1-1701071805875.png

 

Then go back to your app and regenerate the table using the refresh button: 

baba_sawane_2-1701071833464.png

 

 

thank you so much..its working

How about i want to start the id starting with 20000?

 

Top Labels in this Space