I'm sorry if my explanation is a bit hard for you to understand. I've come up with one example that is used to auto-generate serial no/reference no. But the coding was in LotusScript and it is hard to understand. The example declared the CreateRefNo action on the Global section then it links to other documents(forms,views,etc). I really appreciate if someone can come up with a solution that uses formula instead of LotusScript. Thank you...
I think a formula solution would be very complicated. Lotusscript is not very hard, and you should learn it anyway.
Profile documents are described in the online help. Those are documents you use to store information, either for all users or per user. So I would create a profile document (call it "profileCounter", for example) with two fields:
CounterValue - last sequence number used (your "form number")
CounterDate - The date the counter value was last updated, so you can start over each day if you want.
Dim session ans New NotesSession
Dim profiledoc as NotesDocument
Dim lastcnt as Integer
Dim lastdate as String
dim serial as string
dim formname as string
' *** Get profile document and values
Set profiledoc = session.CurrentDatabase.GetProfileDocument("profileCounter")
lastcnt = Cint(profiledoc.GetItemValue("CounterValue")(0))
lastdate = Cdat(profiledoc.GetItemValue("CounterDate")(0))
' *** Was counter last updated a previous/other day?
if lastdate<>Cdat(Today()) then
lastcnt = 0 ' Set last counter to zero
end if
lastcnt = lastcnt + 1 ' Increase counter by one
' *** Write values back to profile document
call profiledoc.ReplaceItemValue("CounterValue",Cstr(lastcnt))
call profiledoc.ReplaceItemValue("CounterDate",format$(today(),"mm/dd/yyyy"))
call profiledoc.Save(true,False)
' *** Now we have the "form number", and can generate the serial number in desired format
formname = "OFDR"
serial = formname & "-" & Format$(today(),"yyyymmdd") & "-" & format$(lastcnt,"000")
Does not have to be very complicated.