Random strings generator

random test.rp (49.4 KB)

Hello community, I have a small question: I would like to create a sort of Random string generator, specifically for ISIN codes (Fund stuff…not fun).
The ISIN composition has a specific rule (in most cases):

  1. first part is composed by two (2) letters
    2.second part is composed by ten (10) numbers

How can I do it properly?
I tried in the file enclosed but I think is not definitely the best solution, and is not even working perfectly.

Try this expression in your Repeater’s Loaded event:

[[alphabet.charAt(Math.floor(Math.random()*(26-1)+1))]][[alphabet.charAt(Math.floor(Math.random()*(26-1)+1))]][[Math.floor(Math.random()*(999999999 - 100000000)+100000000)]][[Math.floor(Math.random()*(9 - 1)+1)]]

I tried wrapping the 10 digit random number into a single expression but it looks like it wouldn’t work with 10 digits, so I split it into 2 separate expressions: one that generates a random 9-digit number and another that generates a random 1-digit number.

Also, it looked like your original file had a Loaded interaction on your Repeater which was setting the rectangle’s text. You also had a separate Loaded interaction on the rectangle contained within your repeater - I don’t think that 2nd interaction is necessary with the above expression on the Repeater Loaded event. Hope this helps!


Thank you, yes in fact was similar to what I did, but I was misspelling some stuff inside the variables. Thanks a lot

1 Like