This is a question that comes up a lot, so creating this topic to use as a reference.
Typically, there are two distinct use cases when it comes to auto-incrementing row numbers.
Use Case 1:
– We need to generate a Part Number, or an Order Number, or an Employee ID. Once the number is generated, it should never change, even if rows are deleted.
– The general approach for this use case is to maintain a static counter, use it to craft a suitably formatted ID, and increment it by one every time a new row is added.
– The following video walks through that step by step:
If the above video won’t play, paste the following into a browser:
Use Case 2:
– For the second use case, we want a dynamic row number that will automatically change as new rows are added/removed.
– The solution for this use case is very simple, and takes advantage of one of the new Array Plugin columns. Credit to @11183 for first describing the approach.
– The following video shows how to do it:
If the above video won’t play, paste the following into a browser:
Hi @Darren_Murphy , thanks for this F.A.Q.
About case 1, I use the same method but with a little variation:
instead of building the two template columns (one in staff, and one in lookup), in lookup I prefer to define a rowid column, retrieve its content in staff via a single value column, and then build a single relation between these two values.
Could it be better from a performance standpoint, in your opinion?
I’m not sure I could say whether one approach is better than the other. The end result is the same in both cases, because you need that single relation. It’s just a matter of how you get there. My guess would be that it probably doesn’t make much difference for this use case. I think your approach is fine
Can you share details of how you implemented this?
If I was to make a wild guess, I’d say it sounds like you might be using some User Specific Columns where you shouldn’t be. But that is just… a wild guess
In the example I showed in the video, the if-then-else column is used to determine if the EmployeeID needs to be zero-padded. You can probably ignore that.
No, it doesn’t look the same to me.
Using the signed in user ID is used in a template to create a relation between the two tables.
Actually, looking back at that now, it could be simplified quite a bit. Instead of using templates to create a relation, we could just use a Single Value → First → Whole Row to grab the whole first row from the Lookup table, and then use a Lookup through that Single Value to fetch the next ID, and also use it for the onSubmit increment action.
Make yourself a copy of the below App and use that as an example for your own - you might find it a bit simpler to understand.
Ok Thanks for the explanation and the copy of the apps
cause since the beginning creating my own apps, im been stuck to that auto increment, already watch the video multiple time, but still dont get it.
hope this method wont show any blank or random number again
No, but if you format the column where the Number is being saved to include a group separator, then it will be inserted when the saved value is displayed.
Obviously, something is wrong. But it’s really difficult for me to say what just by looking at a single screen shot. If you set it up the same as in the concept App, it will work, even with Row Owners applied. So if it’s not working for you, that means you must have done something different. In order to help you solve it, you need to help me understand what it is that you’ve done different.
Ola boa noite… nao estou consegiundo realizar este modelo como no video, sera que poderia me ajudar… ele gera o codigo porem inseri um monte de zero no final…