I have a computed field in which I am displaying total number of documents in a view that meet the criteria. I am using GetAllEntriesByKey and want to pass start date, end date and a name field value as search key string. is there a efficient method to get the result.
Asked
Active
Viewed 322 times
1
-
How shall the dates match? Are start/end a range for one field or separate fields. If separate: if a end date is before the stated end date would the document count? – stwissel Mar 20 '17 at 10:39
2 Answers
2
Create a view with
- first sorted/categorized column with date
- second sorted/categorized column with name
Get the entries with
var v:NotesView = database.getView("yourView");
var query = new java.util.Vector();
var startDate:Date = new Date(2017,1,1);
var endDate:Date = new Date(2017,2,31);
var range:NotesDateRange = session.createDateRange(startDate, endDate);
query.addElement(range);
query.addElement("searchName");
var vec:NotesViewEntryCollection = v.getAllEntriesByKey(query, true);
(Note for second parameter in Date(): January is 0, February is 1, and so on.)

Knut Herrmann
- 30,880
- 4
- 31
- 67
0
You could make the first three columns of the view all sorted columns (start date, end date, name).
The Keys parameter for GetAllEntriesByKey can be an array (Vector in Java)
Set the keys array to have the first entry as the start date, second as end date, third as name.

Rob Mason
- 1,385
- 10
- 23