Reputation: 526
On my first run,I am able to get all my notes documents from my notes database which is "db.nsf".
My problem is next time when i will run same class that time i only want new notes documents
from last run .
There is any optimal way to do this and i tried to searched solution for this but didn't get .
It would be nice if anyone help me.
Upvotes: 1
Views: 278
Reputation: 1377
Scheduled agents have a 'Target' property on the 'Basics' tab of the properties section of Domino Designer. One of the options for 'Target' is 'All new & modified documents'. Others options are 'All Documents in Database' and 'None'.
This option will make the document collection passed into the agent (Java or Lotus Script) contain all new or modified documents since the agent last ran.
I'm not sure if it is possible or not for the documents you are processing to be modified in your app - but either way, I think it would be better to start with this document collection and stamp your own 'processed' flag NotesItem onto the documents you process.
You may also find the java DocumentCollection.StampAll method a handy way to place your flag item on every document in a collection.
Upvotes: 0
Reputation: 14628
Just save the date-time of your previous run, and use the Database.Search()
method. Set the first argument to "@All" and the second argument to that date-time. The NSF file contains structures that allow the API to optimize this query, so the conventional wisdom that Database.Search()
is slow does not apply.
The method will return a DocumentCollection
containing all documents created or modified since your last run. If you want to exclude the ones that were were modified but were really created earlier, just double-check against the Document.Created
property as you iterate through the collection.
Upvotes: 1
Reputation: 27
Explaining this by assuming example , may be this will help you.
first step : while processing your documents from "db.nsf" that time set field inside document by replaceItemValue("check"," done");
second step : create unprocessed view (contained new documents) and set this formula: Select !(check = "done")
Then in your unprocessed view you will get newly created documents or unprocessed documents (which doesn't contained done field)
Upvotes: 1