Automatic customerID generation

Hi

so i have a CRM and i would like to generate the customer ID automaticly is that possible?

I have several different companys in the CRM so lets say i have a company called AAA and i want to create the first customer for company AAA

i want to make the customer ID AAA-1 since this is the first customer and then the next customer i want to call AAA-2 and so on but is it possible to have appsheet generate the ID automaticly ?

Solved Solved
0 4 492
1 ACCEPTED SOLUTION

Itโ€™s also an excellent solution I did it that way too, but repeated IDs can be generated if a previous record is deleted. Thatโ€™s why I switched to calculating the maximum instead of counting the records.

View solution in original post

4 REPLIES 4

How many users do you have with this app?

I prefer to use UNIQUEID() but I have something similar in an application. A parent table with [idpista]=AAAAA and a child table with [idptobserva]=AAAAA_##.

To make the ID of the children table, the solution has two steps: in a virtual field [cod_num] you have to convert the ID number to a number so you can calculate the maximum in step 2.

[cod_num] = NUMBER(MID([idptobserva],6,2))

The initial value of the ID is set to this function:

[idptobserva] = [idpista] &"_"& TEXT(MAX(SELECT(tbl_children[cod_num],[idpista]=[_THISROW].[idpista]))+1)

It works like a normal database, if a record is deleted it will not be used again.

I hope it helps you.

Hi, there may be several ways to achieve this. Take a look at this one:
Letโ€™s assume you have a customer table (CustomerTable) with its corresponding columns and let [CustomerID] and [CompanyName] be two of them.
Then, you can enable your app generate customerโ€™s ID using the following formula:

CONCATENATE([CompanyName],"-",COUNT(FILTER(โ€œCustomerTableโ€,[CompanyName]=[CompanyName]))+1)

Itโ€™s also an excellent solution I did it that way too, but repeated IDs can be generated if a previous record is deleted. Thatโ€™s why I switched to calculating the maximum instead of counting the records.

Top Labels in this Space