Search DominoPower's 11,437 Lotus-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.
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.


« Previous  ·  1  ·  2  ·  3
Other articles you might like
Home > Lotus Technologies > LotusScript (64 articles)
   When the debugger won't debug hidden code that isn't hidden
   What to do if the LotusScript debugger won't single-step over code
   Little known traps about Lotus Notes fields
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent DominoPower Articles
Application development, William Shatner, and the origin of the universe
Learn Domino Designer 8.5 for free
The (near) future of Sametime, Quickr, Connections, and Symphony
Inside the IBM Innovations lab
Lotusphere 2010: Hot fixes and cool news for Notes, Domino, and LotusLive
Lotusphere 2010: mobility and collaboration
2010: A Lotusphere of change
Latest Lotus Headlines
SNTT : XPages onclick Ghosts in the machine
Ports used by Lotus Sametime 8.5 servers
Exploring a Domino Date Bug
Adding Quick Highlighter support to IBM Lotus Notes Domino Wiki, Weblog, or Webpage
Remember Young Admins...there are 2 files
WebSphere Portal 6.1.0.2 and Lotus Domino 8.5
The CKEditor - with Domino
>> Read all the news
More from the ZATZ journals
Computing Unplugged: The iPad defenders have spoken
David Gewirtz Online: CNN commentary and analysis
OutlookPower: More about disappearing text
-- 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.
ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login