Search DominoPower's 11,320 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
Lotusphere 2010: mobility and collaboration
2010: A Lotusphere of change
Five trends for 2010
DominoPower TV Episode 1: Inside a strategy session with Teamstudio
More about Domino log files
Say goodbye to the Uh-Ohs. Long live the Tens.
Why your log.nsf might not be purging properly
Latest Lotus Headlines
SnTT: XPages Blank Calendar Control (Part 2), adding data
Have your Lotus Notes calendar display multiple time zones
Sample Database for Microsoft Office and Lotus Symphony Integration
Symphony 3.0 beta signals another attack on Office
Enabling DAOS on a database - new recommendation
Need your opinion on some new policy settings for Mail
Sometimes IBM Lotus Domino HTTP RPC Agents aren't the answer...
>> Read all the news
More from the ZATZ journals
Computing Unplugged: The iPad: Apple's latest heartbreaker
David Gewirtz Online: CNN commentary and analysis
OutlookPower: Running auto-respond rules when Outlook is closed
-- Advertisement --

Learn Notes and Domino 8 at your place and pace!
Learn Notes and Domino in your office and/or home! TLCC's highly acclaimed distance learning courses for users, developers, and admins will enhance your career and your resume.

The many included activities and demos will make you a pro! Expert instructor help is a click away.

Click here to try a FREE demo course!!

-- Advertisement --

Struggling with exporting Notes data to spreadsheets? No More!
Try IntelliPRINT, The world's leading Reporting, Dashboards, and Analysis solution for Notes & Domino

  • Don't spend unproductive time maintaining different versions of the same spreadsheet
  • Preserve data integrity and security in multi-user environments
  • Create reports in minutes INSIDE Notes
  • Get freedom from iterative report requests, deliver self-serve capabilities

Experience Reporting, Dashboards, and Analysis INSIDE Notes.

Try IntelliPRINT NOW!

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