Question

good day every one.

what are the effect of re-cache if i use it to my updating data? This is what i trying to do, but i need to know what will happen if i replace the no-cache to re-cache

i will explain the idea, in this textbox it will call the last digit in my database and add 1, but i figure out that there is a problem in this, if multiple user using this form there are possibility that the number will duplicate.@If(@IsNewDoc;@Elements(@DbColumn("":"nocache";@DbName;"GPA";1))+1;@Return(GPnum))

my thought guide me in this path, if i use @dblookup to find if there is a duplication in my number but, i dont make it thru .

Was it helpful?

Solution

Recache will not help you avoid duplicates.

You are trying to increment a counter in Lotus Notes to create a unique sequential identifier for documents. This is a problem that has been discussed many times, by many people, for at least 20 years. You can find good information here in StackOverflow and in various other forums, blogs, and articles. The two approaches that work are

  • Store the last counter value in a config doc, and use document locking to assure that you don't have two users accessing and updating it at the same time.
  • Do not set the counter variable directly in user code. Write your code to put a "pending" value in the field, and rely on a scheduled or triggered background agent that runs on only one server to set the final value. (Since the Agent Manager guarantees that only one agent can run at a time in one database, you will not have conflicts.)
  • Don't use a sequential counter for your identifier. Use the @Unique function instead. Documents will have a unique code instead of a unique number.

Please see this answer, and this answer, and this article.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top