codelock function

35 pts.
Tags:
CodeLock
LotusScript
Can anyone explain the real functionality of this function? Where this function must run? Must in be an agent? I'm trying to solve a number duplication problem. Any help or suggestions are welcomed. Thanks
ASKED: January 21, 2008  2:46 AM
UPDATED: February 20, 2008  10:55 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

HI Orland0,
I use code lock when I need to assign a unique Number to a Notes document Field, e.g. A Purchase Order Number.
So if more than 1 processes are trying to get the next number in a sequence but you do not want then to get the same next number you lock the code so they run one after another therefore reducing the possibility of duplicate numbers.

Note, however, that this only works when the other processes competing to run that code are other threads in the same server process. In other words, it works well if you have no local replicas and it’s a Domino web application and is not clustered.

If you do have multiple replicas or you need to support Notes client use, then you need to do something more complicated.

If you have one server and you want to assign the number from a Notes workstation, you can use RunOnServer to cause the agent that assigns the number, to run on the server. Codelock should work in that case (though I haven’t tried it).

If you have multiple replicas, and people assigning numbers in all of them, you have a tough situation to prevent duplications. In that case you might either have a unique prefix for each replica, or else have a single shared number server — this can be done with a web service — but of course this does not support offline use.

Often, people make things difficult for themselves by insisting on a <i>sequential</i> number. The @Unique function creates an identifier that’s almost certain to be unique across all replicas, and it’s very, very easy to use.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • 0rland0
    Hi jellybean, I've tried using codelock to do exactly the same thing that you do..but i still get duplicate numbers.. Do you mind if you tell how you go about doing it? Just the structure will be great!.. Thanks for your time ;)
    35 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following