Get a list of auto 100 generated 10% discount codes (single use)

Hi,

I need to create a list of 100 unique coupon codes o i can print them as voucher to give physically.

Is there a way to do that?

Hi Omri.
Math.random() gives you a random number between
0.0000000000000000 & 1.000000000000000
If you multiply it by 10000000000000000
you have a number with 16 numbers random generated.
if you add it in for loop you can say it has to give 100 numbers
There is always a very small chance to have a duplicate but with such a long number and only 100 coupons needed its olmost not possible.

kind regards,
Kristof.

You can even do a for each loop adding them to a database,
and evrytime checking of the generated number isn’t already in there.

Thanks a lot Kristof
but how do i make those 100 random numbers to 100 copons?

Oke for the coupons its something you are going to print out?

If so, you probably have some sort of image you want to have the number on?

@volkaertskristof thats right😁

@jewelrybelleshop
Add the image here i’ll see if i can make it fast :slight_smile:

@volkaertskristof

@jewelrybelleshop
How long do you want the numbers? :stuck_out_tongue:

@volkaertskristof 9 numbers i think it’s enough
and thank you Kristof

@jewelrybelleshop
Oke i think i made it.

go to this [link](link
https://volkaertskristof.wixsite.com/helpcenter/coupons
Klik)
[https://volkaertskristof.wixsite.com/helpcenter/coupons](link
https://volkaertskristof.wixsite.com/helpcenter/coupons
Klik)
[Klik](link
https://volkaertskristof.wixsite.com/helpcenter/coupons
Klik) on “Generate Coupons”
Wait a 5 sec,
refresh page.
(don’t press twice or you have 200 xD)

Tell me when you are done so i can remove the button or block it from being used :wink:

@volkaertskristof
thank you😍
can you send me the code you wrote?

I will add it on the website,
trying to configure it so the button deletes evrything and then adds new coupons

thanks a lot😘

@jewelrybelleshop
Oke so i added the code to the website link,
1 piece of code just to add data to the database (100 rows)
second piece of code is to remove data from the database and then add data to the database.

Make a database named Coupon,
add a column named “generatedNumber”

Add a dataset and a repeater to your website,
connect the dataset to the Coupon database and connect the repeater to the dataset, link a textfield to the “generatedNumber” Field .
add a background static so its the same for all items.
place the textfield to the write location.

That should do it.

Kind regards,
Kristof.