Increment value as a reference of document

hello,I nead to have a field “chrono” in a form,in wich a counter is incremented in every creation of new document.

Can any one know how can i programm this?

thanks for your help

Subject: Increment value as a reference of document

This isn’t as simple as it seems. If you use a view to get the last entry for example you have to worry about 2 people creating documents at the same time (ie, dirty read) and getting assigned the same number.

Subject: RE: Increment value as a reference of document

In fact that was what i tried,I got the last entry in a vew,i got the field"chrono" in it and i added 1,but like you i’ve thouth about 2 people creating a doc in the same time.So i was wondring if a memory exists in lotus,so that i could creat a java agent wich increment a counter stored in the memory??

Subject: RE: Increment value as a reference of document

It’s way more complex than just that. Lotus Notes is an environment, where people can work locally (i.e. no server connection), replicated databases exists and servers are clustered. If you are asking about a “unique sequence” for generated documents then try to search with these words.

If you go all the way including replication and clustering, a dedicated numbering database comes to mind where servers and probably users are part of the generated number (which will give longer numbers, naturally).

Of course you can look for a “single point of numbering” (i.e. getting sequences from RDBMS or build a single number DB on a single server), but that’s not very “notes like” (see reasons above).

HTH,

Th.

Subject: RE: Increment value as a reference of document

Or one could simply use @Unique without parameters and be done with it. There is almost never an actual business need for sequential numbering, and it’s often counterproductive to use sequential numbers.

For example, take a bug report number. If it’s too small and this isn’t the 1.0 release date, you’re telling the customer that nobody else is dumb enough to use your software. Everyone knows that even if there are no actual bugs in your software – and that’s unlikely – there are no end of things that can cause your customer to think there are. On the other hand, if you pick an arbitrarily high start number, or if the same bug is reported by a couple-thirty thousand customers who were overjoyed when you were able to push out a hotfix patch later that very same day last March, you’re telling the customer that your software is a bug-ridden piece of crap. There is no way to win at that game.