Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

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?

Posted

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.

Posted

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

Lee

Posted

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

Posted

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

Posted (edited)

...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
Posted

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.

Posted

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.

Posted

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

This topic is 6016 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.