Solved

orphand response docs

Posted on 2006-07-03
7
208 Views
Last Modified: 2013-12-18
Hi all,

I have a response hierarchy in one of my databases. Now while testing I have noticed that when I delete the parent document, all other response and response to response documents linked to that deleted parent remain the database. Is there a way that I can make sure that when a main document is deleted its responses and responses to responses are also deleted?

Thank you
Varvoura
0
Comment
Question by:varvoura
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 19

Assisted Solution

by:madheeswar
madheeswar earned 50 total points
ID: 17030023
yes..in the database Script, querydocument delete event, u can delete the child documents of the parent.

See the NotesDocument class for deletion and how to get the childs. (I think get responses)
0
 

Author Comment

by:varvoura
ID: 17030180
OK, here's a script

Sub DeleteDocument( doc As NotesDocument )
      
      Dim dc As NotesDocumentCollection
      Dim respDoc As NotesDocument
      Dim nextDoc As NotesDocument
      
      Set dc = doc.Responses
      Set respDoc = dc.GetFirstDocument
      
      While Not respDoc Is Nothing
            Set nextDoc = dc.GetNextDocument( respDoc )
            Call DeleteDocument( respDoc )
            Set respDoc = nextdoc
      Wend
Call doc.Remove( True )

end sub

I place the above as a function in the database script section.
Then in the querydocumentdelete of the database script I call the function, but nothing happens.
Is my call to the function incorrect or should this not be in the querydocumentdelete section?



Call deletedocument(doc)
      
            
0
 

Author Comment

by:varvoura
ID: 17030189
Even when I paste this in view event and call it from the view which has the parent document, i still have no luck.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 17030215
http:Q_20569942.html "recursivelly marking responses for deletion"

And look at the PostDocumentDelete event in the Database script (under Other/Database Resources)
0
 

Author Comment

by:varvoura
ID: 17030608
I'll give this a try.
However, just curious to why my function above did not work. Is the call to the function incorrect?

0
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 200 total points
ID: 17030936
You might try this:

Sub DeleteDocument( doc As NotesDocument )
     
     Dim dc As NotesDocumentCollection
     Dim respDoc As NotesDocument
     Dim nextDoc As NotesDocument
     
     Set dc = doc.Responses
     If dc.Count=0 Then Exit Sub
     Set respDoc = dc.GetFirstDocument
     Do While Not respDoc Is Nothing
          Set nextDoc = dc.GetNextDocument( respDoc )
          Call DeleteDocument( respDoc )
          Set respDoc = nextdoc
     Loop
     Call doc.Remove( True )

End Sub
0
 

Author Comment

by:varvoura
ID: 17035708
Still a problem, but maybe it is the way i am applying this.
If I have problems I move to your recommeded link.

Thank heaps for trying to help, I really appreciate it.


0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question