|
|
|
|
|
|
|
|
|
|
|
|
|
|
LotusScript's Evaluate command (continued)
Here are some examples:
In the following line, the document being referenced contains a field SourceField:
Result = Evaluate(|@ReplaceSubstring(SourceField; "errr";"error")|, doc)
|
In the following line, which uses extended syntax to reference the field SourceField, will not work:
Result = Evaluate(|@ReplaceSubstring(doc.SourceField(0); "errr";"error")|, doc)
|
In Notes releases 4.1x and 4.5x, the following line (which uses variables to pass some of the @function parameters) will not work:
find$ = "errr"
replace$ = "error"
Result = Evaluate(|@ReplaceSubstring(SourceField; find$; replace$)|, doc)
|
More code The following sample script illustrates how the Evaluate statement may be used to emulate @ReplaceSubString. It makes a copy of the value in a field, SourceField, replaces all instances of 'e' with 'b' and places the result into another field (ReplacedField).
Dim w As New notesUIWorkspace
Dim uidoc As notesUIDocument
Dim doc As notesDocument
'set a constant to the @function using single quotes around the "search for" and the "replace with" parameters
Const Eval$ = |@ReplaceSubstring(SourceField;"e";"b")|
'dim the variable which will be the result of the evaluate statement as Variant
Dim result As Variant
Set uidoc = w.currentDocument
Set doc = uidoc.document
result = Evaluate(Eval$,doc)
'result of the Evaluate statement produces an array so must use subscript
doc.ReplacedField = result
Call doc.Save( True, True )
|
Avoid Evaluate in these situations If you use the LotusScript Evaluate statement with certain @functions, the result is not what you expected.
The Evaluate statement is designed to work with non-UI @functions only. The following @functions cannot be used with the Evaluate statement:
- @Command (and @PostedCommands)
- @DbLookup
- @DbColumn
- @DDEInitiate
- @DDETerminate
- @DDEExecute
- @DDEPoke
- @Prompt
- @DialogBox
- @PickList
Conclusion The LotusScript language continues to mature with each iteration, but a favorite @Function always exists. The Evaluate function allows these favorites to be utilized in LotusScript routines.
Product availability and resources For Tony Patton's article, "Random number generation using LotusScript," in the October 2001 issue of DominoPower, visit http://www.dominopower.com/issues/issue200110/random001.html.
Easy, flexible article reprints ZATZ now offers a quick, easy, flexible and inexpensive way to use article reprints in your marketing and promotion efforts. You can now get article reprints for a one-time fee of only $200. For details, visit http://mediakit.zatz.com/reprints.
|
Jeff Gunther is the General Manager of Intalgent Technologies (at http://www.intalgent.com), a Notes and Domino consulting firm based in Northern Virginia providing collaborative solutions with specific expertise in the healthcare industry. Jeff can be reached at jeff.gunther@intalgent.com.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Advertisement --
Sophisticated Meets Simple For Document Management
Share. Control. Manage.
Documents, emails, and content in the context of how work is done.
Native to Lotus Domino. The User Experience unseen for Lotus Domino.
Do more with less. Really.
See the possibilities Docova unleashes for Lotus Domino. |
-- Advertisement --
Mark your calendar for in-depth Lotus training, May 12-14, Boston
Join experts and peers May 12-14 in Boston for educational and networking events that deliver real-world Lotus training so you can increase productivity and efficiency in your company, advance your skills, and squeeze the most from your current environment. One registration gets you into THE VIEW's Admin2010 and Lotus Developer2010.
Register by April 10 to save $200. |
|
|
|
|
|
|
|
|
|
|