Jump to content

Randomly skipping script steps


This topic is 5775 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

...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 by Guest
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

"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]"?

Link to comment
Share on other sites

This topic is 5775 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.