- Features by Edition
- Latest Features
- Licensing/Activation
- Installation
- Getting Started
- Data Sources
- Deployment/Publishing
- Server Topics
- Integration Topics
- Scaling/Performance
- Reference
- Specifications
- Video Tutorials and Reference
- Featured Videos
- Demos and screenshots
- Online Error Report
- Support
- Legal-Small Print
- Why Omniscope?
|
||||||
DECLARE function (2.6+)DECLARE function (version 2.6+)The DECLARE function allows you to declare a value using an expression (mini formula), then use that value repeatedly within the rest of your formula. It is highly useful in complex formulae where you find yourself repeating the same sub-formula many times, as it makes your formula much clearer, and can yield better performance. Simple example using a single value declaration In its simplest form, DECLARE allows you to declare one named value as follows:
The first two parameters are equivalent to saying "Let myValue = 1+2+3" and declare the value "myValue" as the result of "1+2+3" (i.e. 6). Here myValue is a made-up name which can be whatever you want providing you do not use spaces or numeric operator characters, and no field or variable already exists with the same name. The last parameter is the formula to evaluate in the knowledge that "myValue" is equal to "6". This is the same as the pseudo-code:
This would be the same as the more repetitive formula: (1+2+3)*(1+2+3) + (1+2+3) Advanced example using multiple value declarations Multiple values can be declared by providing more pairs of [name, value] arguments at the start, as seen in this example, which takes a date field (Maturity Date) and breaks it into the numeric Month and Year values, before converting into a long textual representation of that date.
This is the same as the pseudo-code:
This would be the same as the more repetitive formula, which is more error-prone and less clear: IF( |