| Date tip published: | 01/18/2005 |
| Description: | Many Notes 6 developers might not be aware of two new @Functions which can save them time when creating new forms. These two @Functions, @ThisValue and @ThisName, will allow a developer to easily copy a common validation formula to other field's without having to modify the formula for the new field name. |
To learn more about what is in Notes Domino 6.5/6 for developers use the following links:
Notes Domino 6 Application Development Update
Notes Domino 6 Application Development 1
Make Your Formulas Portable
Many Notes 6 developers might not be aware of two new @Functions which can save time when creating new forms. A common validation formula is one that verifies that the user did enter a value in a required text field. This formula shows a typical formula, where FieldName is the name of the required field:
| @If( FieldName = "" ; @Failure("FieldName is required."); @Success) |
This validation formula would be similar for other required fields on the form, differing only in the field's name.
@ThisValue
Many field formulas reference and operate on their own current value. @ThisValue returns the value of the current field and can be used to write portable field formulas which reference their own values.
| @ThisValue
The syntax of the @ThisValue function is as follows:
This function returns the value of the current field. |
@ThisName
The @ThisName function returns the name of the current field. The @ThisName function can be used with the @ThisValue function to create portable validation formulas.
| @ThisName
The syntax of the @ThisName function is as follows:
This function returns the name of the current field. |
Technique: Old versus New
Prior to Release 6, it was necessary to create unique validation formulas for each required field. Notice the similarities in the following three validation formulas:
| @If( FieldName = "" ; @Failure("FieldName is required."); @Success) |
| @If( Address = "" ; @Failure("Address is required."); @Success) |
| @If( City = "" ; @Failure("City is required."); @Success) |
Notice how this Release 6 formula can be used to validate any required field:
| @If( @ThisValue = "" ; @Failure( @ThisName + " is required."); @Success) |
This formula can now be easily copied to the clipboard and pasted into other field's validation formulas without having to change anything.
|