Sequential Field - NOT KEY

Hi again guys,

I am certain somebody have asked this question before, but I besides searching both on the community and Youtube I couldn’t found answer for it.

I need to create a sequential field for a a Quote Form I am building, such as:
PC301
PC302
PC303
etc…

It is important to say that this field will NOT BE A KEY as for indexation purposes, this is just for a presentation reason.

how and where do I build this expression?

@Luis_Gomes_Machado
How many active users you have using this app?

for now none, but I hope to have no more that 15 to 20

@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.

1 Like

I see what you mean… how do you recommend to create an “invoicing system” for instance, that need to have a sequential number?

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.

1 Like

that is something that we consider to implement as well.

If so how do you build the sequential number?

You can always read the last recorded value with a simple LOOKUP(…) expression, stripe the number part and then increment it by 1 and re-join,

CONCATENATE(
	"PC",
	NUMBER(
		INDEX(
			SPLIT(
				LOOKUP(
					MAX(Tablename[_RowNumber]),
					"Tablename",
					"_RowNumber",
					"InvoiceNumberColumn"
				),
				"PC"
			),2
		)
	) + 1
)	
2 Likes

thanx for your help Levent!!