Help with generating a number that falls within the proper syntax

I am currently adding a feature to an app that I’ve already created. the customer wants vouchers that start with “20220001” and go to 20221000" but i cannot seem to figure out how to make it do this. Anyone else ever run into a similar issue? Currently I’ve used a backend workflow to search for the last vouchers number, and add 1, then to repeat until hitting a certain number, but of course after 20220009 I get 202200010.

Hey @mattygb85 ,

I have got a customised solution:

  1. i am creating a database(vouchers) for all vouchers created

  2. add a field “index” with type “number” and also give default value 20220001
    (for now i have only created index field just to show you)

  3. add button and set two diff work flows with “Do when condition is true”

  4. first workflow with condition: “search for vouchers:count is 0” and add action seen in the img

  5. second workflow with condition: “search for vouchers:count > 0” and add action seen in the img

i have tried and tested it and its working.
this is the best i got.
Hope this will be the solution you want.

And it should be 20220010, correct?

Why don’t you do what you were doing

search for the last vouchers number, and add 1

And then add 20220000 to that number? So 20220000 + 1 = 20220001. And 20220000 + 10 = 20220010…

You will need a workflow to handle the errors when (if?) it tries to issue the number 10000.

Hey @rico.trevisan ,

if you set the only one workflow you have given you will get the index number as “1” and not 20220001
because initially there is no data there so it will be: 0+1 = 1
so what really matters is how to start it!!!
the solution for this is given by me above.