Random check unique value

Discussion created by gilo on May 6, 2016
Latest reply on May 8, 2016 by user19752




I have a field which contains a serial number. This number is a random number


Round ( Random * 1000000000 ; 0)


Now I know that is quite impossible but like Mr Murphy says, what can go wrong will go wrong.


If FM would create a random number which is already in use i use


If (Get (LastError) = 504

     SetField (field ; Round(Random * 1000000000 ;0)

This does the trick but, what if Mr. Murphy has a brother and FM creates again a random number which is already in use?



Has anyone an idea on how to script this, that if FM creates a number already in use that it redoes the randoming....


Thx in advance