Hi there,
My issue:
I created a form (myForm.nsf) in which I can enter the IDs of documents to be deleted from the database. To collect these IDs. I used an embedded view to provide field values that are captured when the form is submitted.
In myForm.nsf I can select documents for deletion by clicking the checkboxes in a Delete column. When I submit the form, the specified documents are deleted and myForm.nsf is again displayed, only this time the deleted documents no longer appear in the view.
myForm view uses HTML passthrough to create the checkboxes. The checkbox column has the following formula:
unid := @Text(@DocumentUniqueID);
"[<input type=\"checkbox\" name=\"Delete\" value=\"" + unid + "\">]"
The following is the LotusScript code for the DeleteDocuments agents:
Sub Initialize
On Error Goto ErrorHandler
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim item As NotesItem
Dim docToDelete As NotesDocument
Dim unid As String
' Delete the specified documents
Set db = session.CurrentDatabase
Set doc = session.DocumentContext
Set item = doc.GetFirstItem("Delete"
Forall v In item.Values
unid = v
Set docToDelete = db.GetDocumentByUNID(unid)
' Set docToDelete = db.GetDocumentByUNID("12345"
Call docToDelete.Remove(True)
End Forall
' Now redirect the browser to the previous URL
Print "[" & doc.HTTP_REFERER(0) & "]"
Exit Sub
ErrorHandler:
Print "<h1>Whoops!</h1>"
Print "Error " & Str(Err) & ": " & Error$
If (Err = 4091) Then
Print "<br>The document you tried to delete does not exist in the database."
Print "<br>The invalid document ID is: " & unid
End If
Resume Next
My problem:
I duplicated myForm view, so now I have two views for the same form:
MyForm view1
MyForm view2
When the form is submitted the IDs of the documents are captured in these two
Embedded views at the same time.
The problem is once I delete a specified document by clicking the checkbox in MyForm view1 the same specified document in MyForm view 2 will be deleted as well.
My question:
How can I delete one document in MyForm view1 without deleting it in MyForm view2 ?
How should I change my Lotusscript ?
Should I write a second Lotusscript for MyForm view2 ?
My issue:
I created a form (myForm.nsf) in which I can enter the IDs of documents to be deleted from the database. To collect these IDs. I used an embedded view to provide field values that are captured when the form is submitted.
In myForm.nsf I can select documents for deletion by clicking the checkboxes in a Delete column. When I submit the form, the specified documents are deleted and myForm.nsf is again displayed, only this time the deleted documents no longer appear in the view.
myForm view uses HTML passthrough to create the checkboxes. The checkbox column has the following formula:
unid := @Text(@DocumentUniqueID);
"[<input type=\"checkbox\" name=\"Delete\" value=\"" + unid + "\">]"
The following is the LotusScript code for the DeleteDocuments agents:
Sub Initialize
On Error Goto ErrorHandler
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim item As NotesItem
Dim docToDelete As NotesDocument
Dim unid As String
' Delete the specified documents
Set db = session.CurrentDatabase
Set doc = session.DocumentContext
Set item = doc.GetFirstItem("Delete"
Forall v In item.Values
unid = v
Set docToDelete = db.GetDocumentByUNID(unid)
' Set docToDelete = db.GetDocumentByUNID("12345"
Call docToDelete.Remove(True)
End Forall
' Now redirect the browser to the previous URL
Print "[" & doc.HTTP_REFERER(0) & "]"
Exit Sub
ErrorHandler:
Print "<h1>Whoops!</h1>"
Print "Error " & Str(Err) & ": " & Error$
If (Err = 4091) Then
Print "<br>The document you tried to delete does not exist in the database."
Print "<br>The invalid document ID is: " & unid
End If
Resume Next
My problem:
I duplicated myForm view, so now I have two views for the same form:
MyForm view1
MyForm view2
When the form is submitted the IDs of the documents are captured in these two
Embedded views at the same time.
The problem is once I delete a specified document by clicking the checkbox in MyForm view1 the same specified document in MyForm view 2 will be deleted as well.
My question:
How can I delete one document in MyForm view1 without deleting it in MyForm view2 ?
How should I change my Lotusscript ?
Should I write a second Lotusscript for MyForm view2 ?