All,
I am creating a new document in database 2 from database 1. Works fine all fields that I have stated are being filled in from old doc to the new doc.
Problem: When I create this new document in the different database, the Computed when composed field for the Sequential number is not acting as I would expect/hoped.
Instead of going to the next number in the stated view, it is generating 0001. I believe that means I am not doing some refresh? or something correctly.
Here is the code from the sequential number field:
tmp := @DbColumn(“” : “NoCache”; “”; “(CQA No.)”; 1);
@If(@IsError(tmp); @Return(“Error”); tmp);
tmp1 := @If(tmp = NULL; “0000”; @Subset(tmp; -1));
CurrentContNum := @TextToNumber(tmp1);
NextContNum := CurrentContNum + 1;
Zeroes := (NextContNum < 1000) + (NextContNum < 100) + (NextContNum < 10);
@If(tmp1 != “”; @SetField(“CQANum”; @Repeat(“0”; Zeroes) + @Text(NextContNum)); “Error”)
Here is the code that is creating the new doc in database 2 from database 1.
Sub Initialize
Dim workspace As New notesuiworkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim CC_db As NotesDatabase
Dim doc As notesdocument
Dim CurDoc As NotesDocument
Dim w As NotesUIWorkspace
Set w = New NotesUIWorkspace
Set db = session.CurrentDatabase
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.document
Set CC_db = New NotesDatabase("Edison/SEL","qsiqms\CustQualityImprv.nsf")
Set CurDoc = New notesdocument(CC_db)
CurDoc.Form = "CQA" 'declare what form you are using in the CQAdatabase
CurDoc.status = "New"
CurDoc.OpenDate = Today
CurDoc.ProbNumber = doc.ControlNumber(0)
CurDoc.Customer = doc.CompanyName(0)
CurDoc.FindingDate = doc.DateStarted(0)
CurDoc.Product = doc.MOT(0)
CurDoc.ProbStatement = doc.Containment(0)
CurDoc.ProbSummary = doc.Containment(0)
CurDoc.SolSummary = doc.NCInfo(0)
CurDoc.CC = doc.ControlNumber(0)
Call CurDoc.Save(True,False)
End Sub
I had thought that since I was saving this document that it would then generate the number like it would if I was creating it from the view within database 2.
Any guidance would be most appreciated.
TIA
Teri