Hello again fellow developers.
I’ve got another problem with Lotusscript again. It’s a pretty short problem, but I couldn’t get it solved since i don’t know what went wrong…
Anyway I’ll do some explanation on what I am working on.
I created a view that contains only 3 documents that are only editable, which means that users cannot add a new document into this view, just edit the currently existing documents.
Given that there are 3 documents, with 2 columns each, the first column is the name of the document and the second is the serial number of the document. Eg:
Regular | 9999
Internship | 1000
Contractor | 8000
So I created this form to edit the existing documents, first by choosing what document it is, (Regular, Internship or Contractor) and replace the serial number with a new one typed by the user. Unfortunately, I can’t get the codes to work right, I manage to get the values changed, but for some reason when it reaches Call doc.save, it wouldn’t replace the previous value and save it.
This is the coding:
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim hireType As String
Dim uidoc As NotesUIDocument
Dim workspace As New NotesUIWorkspace
Dim item As NotesItem
Dim doc As NotesDocument
Set uidoc = workspace.CurrentDocument
Set db = session.CurrentDatabase
Set view = db.GetView("View Maintenance")
Dim sNo As String
hireType = uidoc.FieldGetText("type")
sNo = uidoc.FieldGetText("serial_last_number")
Set doc = uidoc.Document
Set doc = view.GetFirstDocument
For i = 1 To 2
If ( hireType =doc.ColumnValues(0)) Then
Set item = doc.replaceItemValue(sNo, doc.ColumnValues(1))
Call doc.Save(True, True)
Else
Set doc = view.GetNextDocument(i)
End If
Next i
End Sub
So I was wondering which part of the coding I did wrong? It’s supposed to be a pretty simple coding but I just can’t get it right…