Link to home
Start Free TrialLog in
Avatar of shuboarder
shuboarderFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Agent to delete all documents from a view where given field has no value

Hi,

I don't think this can be done through simple selection...?

I need an agent that deletes all documents from a view where field "status" has no value.

Any ideas?
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

If this is a once only, then create a view with a Select-statement like
    Select Status=""
then open the view, Ctrl-A to select all documents and type the Delete-key.
Avatar of shuboarder

ASKER

Sorry Sjef,

should have mentioned in original post, I need this to run as a weekly schedule
In a scheduled agent, you can use a similar query. You set it to Scheduled, Weekly, Target is All documents in database. Then, in the Objects pane, there is a property Document Selection. Click at the bottom on Add Condition; you can select a certain form, and a field Status without a value.
Ah, no, wrong, that's a fuill-text search that is done. You need the view AND the agent. The agent opens the view and just removes all documents from the view.

Something like
    ...
    Set view= db.GetView("YourView")
    Call view.AllEntries.RemoveAll(True)
You can't enter a null value for the full text search though...
That's right, not in a full-text query, that's why you need a view with a normal Select-statement and an agent WITHOUT the Document Selection. The agent just opens the view and removes all documents.
Partha had a trick for looking up empty fields, now where did I leave that...

http:Q_21680483.html "Puzzled... (navgup and Bozzie4)"
I think I must be doing it wrong....

Getting the error message:

Maximum allowable documents exceeded for a full text index
ASKER CERTIFIED SOLUTION
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>>Select Form="ABC" and Status=""

But how can I create this?

When you create a view, you get a dialog box. Click at the bottom on Select by Formula and enter the formula above. Then click in Copy From, and select Blank. Now click on Save and Customize to open the new view.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of marilyng
marilyng

Oops, I forgot to say, or you can do the allentries stuff, too, as sjef suggests
I just thought the computed column to "deleteme" was about as clever as instantiating an empty collection,
set coll = view.getAlldocumentsbykey("zzzzzz", true)
then step through your view and add documents that meet your criteria to the collection.
The latter IS clever!
The funny thing about the zzzz, was that I was doing a "price by rules" collection, and wanted to build a new folder and as I found documents, put them in the folder in order to do something.  And I needed an empty collection that I could add to, so I figured that one out.  But couldn't get the private folder to build, so I called Notes Support and was stepping them through my solution.. next thing I know, there's a tech document on how to instantiate an empty collection. :)
Without even mentioning your name or just a simple thank-you?? The attitude of those people...