-
Notifications
You must be signed in to change notification settings - Fork 6
Miscellaneous Functions (MiscUtils.xml)
This provides a few additional general methods for data preparation.
Each function listed below states the category it is added to.
Unit tests for all these functions in MiscUtils.Test folder.
Added to Specialized
category
Syntax: VERSION()
Examples:
-
Version()
returns11.0
(assuming running in 11.0!) -
Version(3, )
returns the Build and Revision number
Gets the Major and Minor version numbers of the Engine as a number. Other parts of the version can be specified by passing arguments to the function.
Added to Specialized
category
Syntax: IFNULL(Value, ValueIfNull)
Examples:
-
IFNULL('A', 'B')
returnsA
-
IFNULL(NULL, 'B')
returnsB
If the first parameter is NULL
, returns the second parameter.
- If both
Value
andValueIfNull
areNULL
, returnsNULL
.
Added to Specialized
category
C++ Function - Coalesce
Syntax: COALESCE(Value1, Value2, ...)
Takes variable number of parameters.
Examples:
-
COALESCE('A', 'B')
returnsA
-
COALESCE(NULL, 'B')
returnsB
-
COALESCE(NULL, NULL< 'C')
returnsC
Generalised version of IfNull
, returns the first parameter which is not NULL
.
- All parameters must be same general type (numeric vs text (including dates/datetimes as text)).
- Minimum of 2 parameters, but can be as many as you need.
- If all parameters are null, returns
NULL
.
Added to Specialized
category
Syntax: ReportError(Condition, Message, ReturnValue)
Defaults: Condition = True, Message = "Reporting An Error!", ReturnValue = NULL
Examples:
-
ReportError()
returns an error ofReporting An Error!
-
ReportError(0)
returnsNULL
-
ReportError(1, 'An Error')
returns an error ofAn Error
-
ReportError(0, 'An Error', 3)
returns3
-
ReportError(0, 'An Error', 'All Ok!')
returnsAll Ok!
Allows you report an error from a function or pass through a value.