Solved

delete documents

Posted on 2004-10-17
5
253 Views
Last Modified: 2013-12-18
Hi Expert,
My form has an action which I want to delete all documents from 2 views and perform some other tasks. For delete documents, I have created 2 agents. When I assign this 2 agent to the action of the form, it always said that I have to run these agents from a view. Is there any way to delete document without using agent?
Thanks,
0
Comment
Question by:khanhna
  • 2
  • 2
5 Comments
 
LVL 13

Expert Comment

by:CRAK
ID: 12336375
You could write code in lotusscript right in the button's Click-event.
Start off at a New NotesSession, use CurrentDatabase to gain a NotesDatabase object. From there use GetView to access a NotesView. From there the approach may depend on what's in it. Either delete doc's one by one or collect a number by key (viewentries or documents) and delete the bunch.

But there's an easier way:
Make the agent run on "all doc's in database".
Press the "Add search" button, select "Folder" and select the view that you want to delete from.
You could use "Simple action" to emtry the view: "Delete from database".

That's all!
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 12336452
can u please paste your code?
It depends on the requirements also. U said it performs other tasks. We want to know what are those other tasks.

if your code is perfect, then in the Agents select RunOnce @Commands....
and run on all documents in view.

This should work.

0
 

Author Comment

by:khanhna
ID: 12336715
Hi CRAK, I write Notes script, and use GetAllDocumentsByKey... and delete one by one... but how can I delete a set of records instead of delete on by one?
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 12336723
no other option.

U have delete one document and refresh the view and get another document and delete.

it is some what tedious method.
Workaround will be to create a view and give the selection formula in the view.

So, it will displayall those documents which are ready to delete. then Select all and delete or u can try with code to delete.
0
 
LVL 13

Accepted Solution

by:
CRAK earned 200 total points
ID: 12336745
All documents have different keys????

I usually perform such larger tasks in separate views, where large numbers of document s(if not all) have the same key (e.g. "A").
GetAllDocumentsByKey("A") will then return a (large) documentcollection. Use RemoveAll(true) to delete all doc's in the collection.

Still.... the simple action is much easier and probably faster!
0

Featured Post

Technology Partners: 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

For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

730 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