Manage Learn to apply best practices and optimize your operations.

@Formula library

Writing a function once and then using it in many places is easy to do when you use LotusScript -- but what about @formula's? In Notes 6 you can do this for @formula's as well.

Writing a function once and then using it in many places is easy to do when you use LotusScript -- but what about @formula's? In Notes 6 you can do this for @formula's as well.

The following example has a date formatting formula, stored in one location and used in different places. It formats a date value as "2005/03/04 Friday."

  1. Create a shared, computed for display text field named DateFormula. Paste the following code in this field (include the braces!)
    {
    @Text(@Year(tmpDate)) + "/" +
    @Right( "00"+ @Text(@Month(tmpDate)); 2) + "/" + @Right( "00"+ @Text(@Day
    (tmpDate)); 2) + " " + @Select( @Weekday
    (tmpDate); "Sunday"; "Monday"; "Tuesday"; "Wednesday"; "Thursday"; "Friday"; "Sa
    turday") }
    

  2. Insert the shared field on your form and make it hidden for Notes and the Web.

  3. If you have two date fields on your form named DateA and DateB. Add computed text (or a computed for display text field) to your form containing the following formula:
    tmpDate := DateA;
    @Eval(DateFormula)
    

    And for the formatting of field DateB of course:

    tmpDate := DateB;
    @Eval(DateFormula)
    

Notice that tmpDate is actually a temporary variable in your formula which is referenced in the shared field code! So this works like a parameter for your @Formula function. There are lots of other possibilities to use this like input translations/validations, buttons and so on.

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip exchange by member Rob Van Den Heuvel. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

Dig Deeper on Lotus Notes Domino Formula Language

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close