@Luis_Gomes_Machado
Being a key or not, sequential numbering have the cons of creating doubles provided 2 or more users try to create a record at the same time. It’s very easy to read the last recorded number from the table and increment it by 1, however when 2 or more users are trying to record a data, as the data is not in the back-end yet, there’s no way for AppSheet to know if the next generated number is already used by another active user or not. Therefore multiple same numbers can be created.
For the apps that I have created for our clients, - in general - we give the privilege to a particular app user for creating invoices, orders etc. that by-nature or by-law or by-major needs sequential numbering. Otherwise, with multiple users, unfortunately there’s no way to prevent the duplicate records.
I have been trying to use the expression that you kindly help me with:
NUMBER( INDEX( SPLIT( LOOKUP( MAX(Contactos[_RowNumber]), “Contactos”, “_RowNumber”, “Num Empleado” ), “” ),2 ) ) + 1
to create an incremental number of a table which contains a list of employees, although each register has its own unique() we need a employee number for other reasons.
When I use this expression is not incrementing the field
the table name is Contactos and the column is Num Empleado
It looks like the SPLIT() portion of your formula is missing the “PC”. If nothing has changed with your invoice numbers, your formula should be in the format:
This portion of the code is returning the most recent invoice label by assuming the highest row number contains the most recent invoice. The output from here should be a single invoice in the format PC1234 as long as nothing has changed.
EQ2
SPLIT(EQ1, "PC" )
This portion of the code is SPLITTING the returned invoice number into a list where it finds the substring “PC”. The output here will be a list of two strings, in the format {PC, 1234}. Note that your issue may be occurring here - you do not have the “PC” in the formula you posted.
EQ3
NUMBER(
INDEX(EQ2, 2)
) + 1
This portion of the code is selecting the second element from the referenced list, In this case the numerical string, converting the string into a NUMBER, and incrementing it by 1.
EQ4
CONCATENATE("PC",
EQ4
)
This portion of the code appends the “PC” prefix to the incremented invoice number.
Danger Ahead! In general, sequential numeric identifiers (i.e., serial numbers) are risky in AppSheet: if two users happen to add rows at the same time, both rows could be assigned the same serial number, which could lead to confusion (at the least) or data loss (at the worst). For this reason, serial numbers are strongly discouraged! Basic Serial Numbers One way to implement serial numbers is with a normal (not virtual) column named (e.g.) Serial of type Number and an Initial value expression …