Email:   
Home
In This Issue
EasyPrint
Click here for the RSS feed's XML code. This is not a browser URL.
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





[ Next ]

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
-- Advertisement --

AUTOMATE LOTUS NOTES USER ID MANAGEMENT
ID Manager 4.5 from HELP Software provides a new level of automaton for managing Lotus Notes IDs. ID Manager lets Lotus Notes administrators get out of the business of creating and managing user IDs. Use our ROI calculator to see how quickly ID Manager will pay for itself.

Learn more about HELP Software products
-- Advertisement --

SECURTRAC - MONITOR AND CONTROL YOUR DOMINO ENVIRONMENT
When it comes to your business, how do you ensure compliance with SOX, HIPAA or other industry driven regulations? Use SecurTrac to monitor and audit the life cycle of all objects in your Domino environment.
  • Database Monitor
  • Mail Monitor
  • Domino Directory Monitor
  • Notes.ini File Monitor
  • Intrusion Detection Monitor


Click here for details and a free evaluation copy.
Copyright © 1998-2008, ZATZ Publishing. All rights reserved worldwide.
Editor's Login