Auto increment 5 digit number

I am new to bubble and have been asked to create an auto incrementing 5 digit number field on adding a new record to my “orders” db. made a field called order_id and am thinking I should look up the last order in the db, use the order number from that last order, and count: add 1 or something. read this thread…

but can’t follow the solution to implement it. could some kind soul please give me a bit more info. I can’t find it in bubble.

Make sure “order_id” is a number. Then when you create the order, in the workflow, search for amount of orders then + 1

image

If you look at the end of the slug creation, it does a serch for the number of games there are, then adds 1 to that number to make it the slug. Just apply the same logic, “Search for orders:count +1”. If you wanted to so x5 instead of +1 my math logic might be wrong but you get the point. Thats how i do it for my slugs but the same logic applies to modifying a number.

thanks for replying, but I am not trying to add up orders to get the order number, I am trying to lookup the last order and add one. I think that is going to be safer and more reliable since orders may come and go, get archived or deleted, what have you. does that sound like a reasonable approach, or am I missing something?

You could just do a search for the orders and select the last item’s order # the do the math I believe that would work, that way you are pulling the order # you previously made.

got it! I don’t even know how I just stumbled into it. thanks!

Lol yea most things i just had to learn on my own or accidentally did lmao, glad you got it

1 Like