June 3, 200817 yr I have been experiencing random errors with scripts. It seems it is just randomly skipping script steps in different places on different client machines. Sometimes is works sometimes it doesn't. Like if I run it through script debugger it doesn't skip anything, but without it, it skips large chunks of the script. Does anyone have any insight on why this is happening? I have tried to rule out numerous things, like rebuilding the script, setting it to a different script, recovery, save compact copy, etc with no results. There is no connection or consistency to the error. Help... Please... Somebody?
June 3, 200817 yr What kind of steps are being skipped? Perhaps you can PDF or JPG a copy of your script and post it so that we may try and help you better.
June 4, 200817 yr Author After trying to create hundreds of records with this script, a pattern finally emerged... I have an auto-enter on creation username and password field that is supposed to create a unique random number with this calculation. Int(Truncate ( (Random * 100000000) ; 0 )) It appears it has been trying to create duplicate username/passwords, and upon validation it fails because it is not unique. Then it resumes to skips over the rest of the "New Contact" record creation script. No error, no dialog no nothing during validation. This would explain why it was only happening sometimes. I do need to figure out why the random number generator is not working correctly. Am I off base on my calculation? There has to be a better way to generate unique random username/passwords. Any help is appreciated. thanks
June 4, 200817 yr ...there has to be a better way to generate unique random Unique random is an oxymoron. Random can duplicate because it is, well, random. Why not use auto-entered serial numbers? Edited June 4, 200817 yr by Guest
June 4, 200817 yr Unique random is an oxymoron. Well, not really. Only the notion that random implies unique is incorrect. But the two are not self-contradicting - it is possible to generate numbers that are both random AND unique, e.g. Loop Set Variable [ $n ; Random ) Exit Loop If [ IsEmpty ( FilterValues ( $n ; List ( AllRecords::Numberfield ) ) ] End Loop ... Of course, the time it will take to exit the loop will increase as the number of records grows, until it gets to a point where all possible numbers have been used up, and the loop will be infinite. --- BTW, the Int() portion in this: Int(Truncate ( (Random * 100000000) ; 0 )) doesn't do anything, since Truncate ( n ; 0 ) has already done it all. A simple: Int ( Random * 100000000 ) would suffice.
June 5, 200817 yr Author well I didnt want to use serial numbers thinking someone might be able to pick out a pattern.. but I did find this in another post... Let ( [ alpha = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" ] ; Middle ( alpha ; Ceiling ( Random * Length ( alpha ) ) ; 1) & Middle ( alpha ; Ceiling ( Random * Length ( alpha ) ) ; 1) & Middle ( alpha ; Ceiling ( Random * Length ( alpha ) ) ; 1) & Middle ( alpha ; Ceiling ( Random * Length ( alpha ) ) ; 1) & Middle ( alpha ; Ceiling ( Random * Length ( alpha ) ) ; 1) & Middle ( alpha ; Ceiling ( Random * Length ( alpha ) ) ; 1) ) that field is set to require unique so after the username field is set with that calc in a "create username" script I added... Commit Records/Requests If[Get(LastError) <> 0] Perform Script ["Create Username"] Exit Script [] End If so it runs till its passes validation. Seems to work great. thanks for the help.
June 5, 200817 yr "No error, no dialog no nothing during validation. This would explain why it was only happening sometimes." Do you perchance begin every script with "Set Error Capture [On]"?
Create an account or sign in to comment