Search DominoPower's 11,441 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.
PROGRAMMING POWER
LotusScript's Evaluate command
By Tony Patton

The basic premise of Evaluate is allowing the use of @Functions within LotusScript. Although LotusScript is very poweful, Domino developers often find themselves clamoring for their favorite function in certain situations.

Syntax
Evaluate accepts one parameter and returns a Variant object. The parameter contains the @Function code, and the Variant contains the results of executing the specified @Function. Here is the syntax from Lotus Help.

Evaluate ( "macro" [, object] )

The macro is a String representation of the Lotus @Formula to be evaluated. It may be a variable or constant. The value had to be a constant in pre-R5 versions, but this was corrected in R5.

The second parameter is optional; it is used to signify the name of a product object (if Lotus is not used). I have never seen this used, so it's not covered in this article.

Return value
As previously stated, the return value is returned in the form of a Variant object. The return value of the actual @Formula is text, but the Evaluate function returns a Variant. The first value in the Variant (zero) contains the return value, and an empty return value signals nothing returned from the @Formula or an error.

In action
Evaluate usage will depend on your needs and Notes version, but here are a few examples showing Evalute in action.

I always liked the @Adjust formula. It allows easy manipulation of time-date values. The individual components of a time-date may be incremented/decremented accordingly. Here is its syntax from Note help.

@Adjust( dateToAdjust ; years ; months ; days ; hours ; minutes ; seconds ; [ DST] )
Parameters
dateToAdjust Time-date. The single time-date value to be manipulated.
years - Number. The number of years to increment by.
months - Number. The number of months to increment by.
days - Number. The number of days to increment by.
hours - Number. The number of hours to increment by.
minutes - Number. The number of minutes to increment by.
seconds - Number. The number of seconds to increment by.
dst - Keyword. Optional. Specify [InLocalTime] to further adjust the time for daylight savings if the adjustment crosses the boundary and daylight savings is in effect. Specify [InGMT] or omit this parameter to not further adjust the time for daylight savings. The adjustment is such that adding or subtracting in day increments yields the same time in the new day.

Now, @Adjust is used in LotusScript. A LotusScript function is used to take advantage of it whenever needed. The function allows the year, month, and/or day portion of a date-time value to be manipulated.

Consider this first example.

Function AdjustDate ( pYear As Long, pMonth As Long, pDay As Long, pDate As Variant ) As Variant
Dim temp As String
temp = |@Adjust([| & Cstr(pdate) & |];| & Cstr(pYear) & |;| & Cstr(pMonth) & |;| & Cstr(pDay) &|;0;0;0)|
AdjustDate = Evalute ( temp )
End Function


1  ·  2  ·  3  ·  Next »
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
Xpages not loading? JVM errors? - Solution
How to implement an iCalendar feed into your Notes calendar with XPages
DWA Hotfixes for Domino 8.5.1FP1 - A Gotcha
IBM Adds DB2 to Lotus Foundations SMB Package
SNTT : XPages onclick Ghosts in the machine
Ports used by Lotus Sametime 8.5 servers
Exploring a Domino Date Bug
>> 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 --

Find unused Lotus Notes groups and clean up your address book
Have you ever wanted to get rid of old Lotus Notes groups that were cluttering up your address book, but you weren't sure if they were used? Find Unused Groups can help.

Find Unused Groups will check your ACL, mail, multi purpose and server groups to help you determine if they are used, and who uses them.

Learn how to easily clean up your address book.

-- Advertisement --

Teamstudio Edition 25 has shipped
It's finally here! Now that Teamstudio Edition 25 has shipped, listen to our latest Tool Time audio program to find out what's changed. Updates to all your favorite Teamstudio tools will be discussed.

Plus, you'll get an introduction to Teamstudio Undo (formerly known as Teamstudio Snapper).

Tap here to get started!

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login