Autonumber field
Autonumber field
(OP)
I need to create a 5 digit autonumber field for document tracking. Does anyone have any suggestions on the best way to go about this? It is needed to assign a document number to each document so it can be easily tracked. I look forward to any suggestions.
RE: Autonumber field
Does the identifier have to be 5 digit only? The reason for asking is that there is a built-in @Unique function that is designed specifically for what you're after.
RE: Autonumber field
RE: Autonumber field
Create a view of the documents consisting of one column -- the id numbers. On postopen event open the view above. Use Method "GetLastDocument" of NotesViewClass. Get the id field from that last document and increment it and fill the id field on the new document with that number. If you have to have leading zeros you will need to create a function called here to input them. When the document is saved it will then have the next id number in sequence. You could also do this on the QuerySave event but the user would never see the number. If you need to create more than 99999 documents the called function will need to be a little more complicated because you will be using a text value rather than a number.
RE: Autonumber field
u can use a profile field for automatic number generation....
this has to be used with the setprofilefield and get profile field functions....
if interested i can send u the details
ciao
RE: Autonumber field
RE: Autonumber field
Just the question I was about to ask. I like the @Unique function, but it also does not fit my needs exactly. I need a unique identifier for each document. Much like you described above. Please let me know how I might do the following... if it differs from above.
1) Upon opening a new form... assign it a unique id.
2) Numerical values only.
3) Auto increment.
Any detailed instructions would be greatly appreciated.
BH2
RE: Autonumber field
email me for details....
RE: Autonumber field
CRS
RE: Autonumber field
RE: Autonumber field
Tried to find an e-mail address to get more detailed instructions, but couldn't find one. I'd like to get your help on this issue.
Thanks in advance,
BH2
RE: Autonumber field
RE: Autonumber field
If this does not work I have a DB template that will. Email me and let me know.
cmchess
Create a view GetNumber with ProjectID filed sorted largest to smallest. It will take last (largest) number and add 1
@If (@IsNewDoc & @IsDocBeingSaved; @Success;@Return(ProjectId));
Num := @DbColumn("Notes":"NoCashe";"";"GetNumber";1);
Num1 := @If(@Iserror(Num) | Num="";0;@TextToNumber(@Subset(Num;1)));
NewNum := @Text(Num1+1);
@Right("0000" + NewNum;4);
ANOTHER METHOD:
@If(@IsNewDoc & @IsDocBeingSaved; @Subset(@DbColumn("" : "NoCache"; ""
: ""; "RMA Number"; 1); 1) + 1; RMAno)