Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

delete-embedded view

Status
Not open for further replies.

insiun

MIS
Jan 10, 2001
4
MY
Hi there,

My issue:

I created a form (myForm) 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. 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 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);
&quot;[<input type=\&quot;checkbox\&quot; name=\&quot;Delete\&quot; value=\&quot;&quot; + unid + &quot;\&quot;>]&quot;



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(&quot;Delete&quot;)
Forall v In item.Values
unid = v
Set docToDelete = db.GetDocumentByUNID(unid)
' Set docToDelete = db.GetDocumentByUNID(&quot;12345&quot;)
Call docToDelete.Remove(True)
End Forall

' Now redirect the browser to the previous URL
Print &quot;[&quot; &amp; doc.HTTP_REFERER(0) &amp; &quot;]&quot;
Exit Sub

ErrorHandler:
Print &quot;<h1>Whoops!</h1>&quot;
Print &quot;Error &quot; &amp; Str(Err) &amp; &quot;: &quot; &amp; Error$
If (Err = 4091) Then
Print &quot;<br>The document you tried to delete does not exist in the database.&quot;
Print &quot;<br>The invalid document ID is: &quot; &amp; unid
End If
Resume Next



My problem:

I duplicated myForm view, so now I have two views:

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 ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top