Lazy code
A best practice for coding involves delaying slow operations until certain they’re needed, then caching the result.
A best practice for coding involves delaying slow operations until certain they’re needed, then caching the result.
The general term for it is “associative array” — a collection of values indexed by a string rather than a numeric index. You might be thinking you already know about the List datatype in LotusScript, but there are a few tricks you might not have thought of. Basics Declare a variable of type List As datatype — for instance, Dim docsByColor List As NotesDocument Read and set values as you would an array, but using a string as your index value. Set docsByColor(doc.color(0)) = doc In this example we’re building an in-memory collection of documents that we can search by the value of their color field, so: Function getDocOfColor(ByVal color$) As NotesDocument If IsElement(docsByColor(color)) Then Set getDocOfColor = docsByColor(color) End If End Function Attempting to access an element with a key that’s not found in… Read More »Wonderful List datatype in LotusScript
In this first of a series of posts about data structures in LotusScript, I show how to create super large arrays.
Introduction to data structures in LotusScript.