When adding a new user I want to create a Personal ID Number. This will be used to append to invoicing and other things that users create. This is different from the unique ID that is generated in glide to ID a row.
The first person… let’s say me would have a Personal ID Number of 101. If a new user is added to the user sheet I would like their ID to be 102. Is there a way to look at the cell above in a column to then increment a number in the current cell?
You’ll find a couple of different options in the following thread:
You’ll find two main alternatives in that thread. One uses Glide computed columns, and the the other uses a Spreadsheet formula. Which is best for you depends on your use case - probably the Glide solution is better for you in this case.
How are you adding the user to your app? If the users are submitting a form, then the easiest way to do this is to use the UNIQUE ID component. This will give you a long string, which will definitely be unique and separate from the ROW ID. This is a SPECIAL VALUE component called “unique identifier” that will automatically be created when the form is submitted (other similar SPECIAL VALUE components are time/date stamp and user email).
If that doesn’t work for you, you may need to do apply your preferred numbering system after-the-fact (after a user already exists in your app). In that case, you’d need to find something else in the work flow that would prompt users to enter further information. Then you’d create a CUSTOM ACTION for the button press, that would invoke the INCREMENT feature for a column as a background to what the user is doing for you (like adding a preference, or secondary contact info, etc).
Does this work? The increment function adds a value to a number in a given cell. How can it be used to create a consecutive number for each row, eg, row 1 value is 501, row 2 value is 502, etc…
You assign the number when you add the row, so in most cases, what you do is have a rollup column that will get the max sequence number, then a math column to add 1, then pass that math value through a form or add row action to write the value to the sequence number column in the new row. This will update the rollup and math so it’s ready for the next row that’s added.
As for the increment method, you would probably have a single location or table to store that value, then increment it through a single relation to that table, then pull it back through the relation to whatever process is adding the row. That method seems more complicated that the first though.
In either case, neither solution is ideal. It will work fine unless you have multiple users using the app and adding rows at the same time. The math or increment will be adding to the number locally on the device, before it syncs back to the server and back out to other user devices, so you could very well end up with duplicate numbers. Glide doesn’t have a good solution for sequencially numbering rows, so I tend to avoid it and just use unique IDs or row IDs instead. Some sort of script would be the safest solution.