Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 287
  • Last Modified:

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?
0
shuboarder
Asked:
shuboarder
  • 10
  • 4
  • 4
2 Solutions
 
Sjef BosmanGroupware ConsultantCommented:
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.
0
 
shuboarderAuthor Commented:
Sorry Sjef,

should have mentioned in original post, I need this to run as a weekly schedule
0
 
Sjef BosmanGroupware ConsultantCommented:
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.
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!

 
Sjef BosmanGroupware ConsultantCommented:
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)
0
 
shuboarderAuthor Commented:
You can't enter a null value for the full text search though...
0
 
Sjef BosmanGroupware ConsultantCommented:
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.
0
 
Sjef BosmanGroupware ConsultantCommented:
Partha had a trick for looking up empty fields, now where did I leave that...

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

Getting the error message:

Maximum allowable documents exceeded for a full text index
0
 
Sjef BosmanGroupware ConsultantCommented:
Recipe:

For the view "YourView":
- Select-statement indicating the documents you need removed, e.g.:
    Select Form="ABC" and Status=""
- one column, content is not important
- don't show a hierarchy

For the agent:
- Scheduled, Weekly
- Target is All documents in database
- nothing at all in the Documents Selection
- code like
    Dim ns As New NotesSession
    Dim db As NotesDatabase
    Dim view As NotesView
    Set db= ns.CurrentDatabase
    Set view= db.GetView("YourView")
    Call view.AllEntries.RemoveAll(True)

Stirr well, let simmer for 15 minutes. Serve with Dominos and Notes ;)
0
 
shuboarderAuthor Commented:
>>Select Form="ABC" and Status=""

But how can I create this?

0
 
Sjef BosmanGroupware ConsultantCommented:
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.
0
 
marilyngCommented:
Hey, dudes...

Do the view selection stuff,

But in the view, set the first column formula to ="deleteme" and sort ascending.

Now your agent gets a collection=view.getalldocumentsbykey("deleteme",true)
call collection.removeall... etc.

Done in a few lines.
0
 
marilyngCommented:
Oops, I forgot to say, or you can do the allentries stuff, too, as sjef suggests
0
 
Sjef BosmanGroupware ConsultantCommented:
:)
0
 
marilyngCommented:
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.
0
 
Sjef BosmanGroupware ConsultantCommented:
The latter IS clever!
0
 
marilyngCommented:
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. :)
0
 
Sjef BosmanGroupware ConsultantCommented:
Without even mentioning your name or just a simple thank-you?? The attitude of those people...
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!

  • 10
  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now