GetAllDocumentsByKey - last value

I’m trying to incorporate something similar to @dblookup in a LotusScript Agent.
I’ve tried Evaluate for the @dblookup statement, but am getting nowhere.
I’ve read that you can use GetAllDocumentsByKey.
Does anybody know how I can use this to return the last value in a specific column/field gathered by the collection of documents?

Subject: What is your question?

"Does anybody know how I can use this to return the last value in a specific column/field gathered by the collection of documents? "

Do you want the value from the last column for one, all, some, first, last, random doc?

If you need the value from all docs in the collection, then just loop through the collection and call the field for each doc.

You can use ViewEntries to get column values but I’m not sure that’s any faster than looping a collection. If the collection is large, you probably want to do some time testing to see which runs faster. Speed will vary if you’re running the code on the client or as a server agent.

If your collection is large, can you create a key that gives you smaller collections? Perhaps a hidden view that makes each doc unique (assuming you’re wanting to get data from one and only one doc).

Subject: Evaluate

Did you see this: IBM Developer https://www.ibm.com/developerworks/lotus/library/ls-The_Evaluate_statement/index.html ?

Might help with the @DBLookup

Might also try GetAllDocumentsByKey to get a DocumentCollection, then GetLastDocument to retrieve the last document from the collection.

Subject: Thanks

Cheers fellas, I’ll take a look.

Subject: You’re almost there with LotusScript.

Yes, as Mark says, GetAllDocumentsByKey will return the last doc in the collection. However – this is the last document in natural order (increasing NoteIDs). Often this is the last doc created for the category – but it’s not sorted the way the view is.

If you are truly looking for the last doc in the view category, try GetAllEntriesByKey.

What’s more, GetAll**ByKey() calls suffer from a longstanding problem introduced about R5.0.3. To avoid this problem, you cannot use subcategories in the view you’re looking-up. Otherwise you may get the most-recent document and nothing else.