I am attempting to write script for an app that is in a clustered environment. I have decided not to write code to lock and unlock “Tracking” notes documents that keep track of current sequential numbers. Basically everytime a document is created a unique number is generated (by increments of 1). This is automated so that even 20 documents at a time is created automatically with button click.
My problem now is that duplicate numbering is happening. Because 2 or more workstations can access the “Tracking” number document which contains a number that the scripts increments.
There are no Notes errors, just continous new documents but with duplicate #s. My code checks for edits and saves that cannot be made. I am incrementing one each time. The script still generates duplicate numbers.
Anyone have ideas on how to continue with the next number without dups?
See sample script below:
If doc.Save(False, False) Then
Print "saved."
Else
Msgbox "NOT saved."
' Get next #
For i = 1 To 100
Set doc = view.GetDocumentByKey( "NextNumber", True)
Call GetNext
NextNbrBPlusOne = NextNbrNNN + 1
doc.NextNbr=NextNbrBPlusOne
Call doc.Save(False, False)
If doc.Save(False, False) Then
Exit For
Else
Set doc = Nothing
End If
Next
End If