I would like to create a shared form which will be accessed every time a document is created by the created documented, and increment a number on that form. . . like a tracking number system. Can someone help me with an example or code snippet?? Thanks
Subject: Shared Form
If you are trying to implement a sequential numbering system on your new documents then there are many reasons why this is not a good idea. Search this forum for sequential AND number and you will find many posts that explain the reasons why.
If you just need to know how many documents have been created with a certain form at any time then this can be done in several different ways using lotusscript.
Create a view that displays all the documents for your form
and then put the following in an action button
Dim session as new notessession
Dim db as notesdatabase
Dim view as notesview
Dim vc as notesviewentrycollection
Set db = session.currentdatabase
Set view = db.GetView(“VIEWNAME”)
Set vc = view.AllEntries
msgbox vc.count & " documents currently exist"
Subject: RE: Shared Form
It is a common requirement. Search this forum for how. Be sure NOT to use a profile document if it will be done from browsers.
Subject: RE: Shared Form
It is a common request to have a sequential numbering system and a lot of posts on the forum try to explain how to achieve it but will not work 100% of the time.
There are several issues such as more than one user saving a document at the same time, database replicas etc that are explained in other posts about this issue.
Subject: RE: Shared Form
DO NOT use a profile document for seq. numbering regardless of how it is being used.
Subject: Shared Form
I always liked this idea:
Now if you have a field called TrackNo, the field would be a Computed when Composed field, and the formula would be:
now:=@Now;
yr:=@Text(@Year(now));
mo:=@Text(@Month(now));
day:=@Text(@Day(now));
hr:=@Text(@Hour(now));
min:=@Text(@Minute(now));
sec:=@Text(@Second(now));
suffix:=@ReplaceSubstring(@Name([CN];@UserName); " "; “”);
yr + mo + day + hr + min + sec + “-” + suffix
Now if you want a view that sorts this, you could put this in the first column:
@ToNumber(@Left(TrackNol"-"))
It creates a fairly long tracking number, but is all but guaranteed to be unique. See if that would work for you.
You could also have another view that categorized off of the suffix. The new categorized column would simply be @Right(TrackNo;“-”)
The category would have the common name stripped of any spaces, so you can play with this if you want to.
- Matt