I have a process called PC Inspection. When copy inspection, batch no will be change every time inspection is done. And there is pc inspection form called EmpPCSpec. It will copy data from computer document.
I can create batch but it only created for one document selected only.
Below are the lotusscript code to set new batch and create pc inspection form.
Sub Click(Source As Button)
Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Set db = session.CurrentDatabase
Set collection = db.UnprocessedDocuments
Dim ws As New NotesUIWorkspace
Dim uiview As NotesUIView
Set uiview = ws.CurrentView
answer% = Messagebox("Do you want to set batch number?", 4,"Batch Number")
If answer% = 6 Then
InputBatchNo = Inputbox("Please insert the Batch Number. eg : 2014A")
If Not InputBatchNo="" Then
For ii = 1 To collection.count
Set doc = collection.GetNthDocument(ii)
currbatchno = doc.PBatchNo(0)
'--------------------------------------
Gosub SetNewBatchNo
'---------------------------------------
doc.PBatchNo =newbatchno
'------------ set new acceptance form ---------------------------
If doc.PStatus(0) = "Active" Then
Set comdoc = New NotesDocument (db)
comdoc.Form = "EmpPCSpec"
comdoc.ATagNo = doc.PTagNo(0)
comdoc.AYear= Left(InputBatchNo,4)
comdoc.ADept= doc.PDept(0)
comdoc.AUserName= doc.PUserName(0)
comdoc.AUserID= doc.PUserID(0)
comdoc.AUserGroup= doc.PUserGroup(0)
comdoc.ALocation= doc.PLocation(0)
comdoc.AStatus= doc.PStatus(0)
comdoc.ABatchNo=doc.PBatchNo(0)
comdoc.AProcessor= doc.PProcessor(0)
comdoc.ASerialNo= doc.PSerialNo(0)
comdoc.ABrand= doc.PBrand(0)
comdoc.AModel= doc.PModel(0)
comdoc.AType= doc.PType(0)
comdoc.ADisplayUnit= doc.PDisplayUnit(0)
comdoc.ADisplaySize= doc.PDisplaySize(0)
comdoc.ADisplayBrand= doc.PDisplayBrand(0)
comdoc.ARam= doc.PRam(0)
comdoc.AHDD= doc.PHDD(0)
comdoc.AIPAddress= doc.PIPAddress(0)
comdoc.AOperatingSys= doc.POperatingSys(0)
comdoc.ACalLicense= doc.PCalLicense(0)
Call comdoc.ComputeWithForm(False,False)
Call comdoc.save(True,True)
'----------------------------------------------------------------
Call doc.ComputeWithForm(False,False)
Call doc.save(True,True)
End If
Next
Messagebox("Process completed." & Chr(13) & "Press 'F9' to refresh the view.")
Else
Messagebox("Please insert Batch Number.")
End If
End If
Exit Sub
SetNewBatchNo:
currbatchno1 = Strtoken(currbatchno, "-", 1)
If InputBatchNo = currbatchno1 Then
seqno = Strtoken(currbatchno, "-", 2)
newseqno = Val(seqno) +1
newseqno1 = Format(newseqno, "0000")
newbatchno = InputBatchNo + "-" + newseqno1
Else
newbatchno = InputBatchNo + "-" + "0001"
End If
Return
End Sub
How can I get all document where if status is "Active" by looping it? Any help will be appreciated. Thanks!