Solved

delete documents

Posted on 2004-10-17
5
249 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now