Hi there, for my app I want when a user creates a data record bubble will then generates ascending ID (AB-GH-00001, AB-GH-00002) and so on, also I want the field of the id to be visible while they filling in the record info like in the screenshot attached.
In a past life I was a CPA, so for the purpose of explaining this I’ll just assume it’s an invoice number
So if you had a table in the DB full of invoices for example. Then you’d have a list of records with
This would need to be stored as text, but if the number of numbers at the end (i.e. the 00001) is always 5 digits, and the numbers always go up sequentially, then all you need to do is to do a search for the last item in the invoice table and return the invoice number. That’ll give you the starting point.
The slightly tricky part now is to construct the invoice number for the next… i.e. in this case AB-GH-00004
So you’d select the last invoice number and use “truncated from end to 5” which will strip out the last 5 digits, and then you’d convert it to a number. Now as a number you can add 1 number.
This isn’t the best example, so forget it’s a Stripe ID for a moment and imagine it’s the last item in the invoice table, or that my action is making changes to a user instead of creating a new record. But look at the argument in blue and it’ll give you the general idea
The will result in 00004. So now you’d just need to add back on the first part. This could look something like this and would return AB-GH-
and now you just put it all together
Josh @ Support Dept
Helping no-code founders get unstuck fast save hours, & ship faster with an expert on-demand