Hi. Is there a way in Custom Reports (in Accounts Payable) to generate a random number (preferably a 3 digit number)? I have tried using SYS(2015) but that generates a much longer (like 9 charachters) alphanumeric character string where I would like a 3 digit numeric.
Thanks for any help you can provide.
----- Brent -----
Random Number Generator
Moderators: Moderators, Tech Support
-
- Tech Support
- Posts: 3018
- Joined: Thu May 13, 2004 9:59 am
- Location: PowerChurch Software
- Contact:
Re: Random Number Generator
Unfortunately, there isn't a truly random number function. RAND() returns a predetermined chain of "random" numbers. Every time you run PowerChurch, it would start that same chain of numbers over again.
So, here's the best that we can come up with in a single expression:
That is ridiculous and still isn't truly random for more than a day, but it's based on the number of milliseconds since midnight each day, so it's probably close enough. Also, it is possible that these could return a one or two digit number, so the numbers are formatted to include leading zeros (001,011) if necessary.
Code: Select all
TRANSFORM(CEILING(RAND()*1000),'@L 999')
Code: Select all
TRANSFORM(CEILING(RAND(SECONDS()+CEILING(RAND()*1000))*1000),'@L 999')