Jump to content
Sign in to follow this  
SXSW

Randomly skipping script steps

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?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

On the Mac, you can print to Preview, and then copy and paste from that.

Lee

Share this post


Link to post
Share on other sites

Stuff like this is usually the result of records being left un-committed.

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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]"?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

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