Exits the calculation immediately under specified logical conditions. You can use the IF... ELSEIF calculation command block to specify the logical error conditions, and use the @RETURN function to exit the calculation with customized error messages and levels.
Syntax
@RETURN ("ErrorMessage", [,INFO|ERROR|WARNING])
Parameter | Description |
---|---|
ErrorMessage | An error message string, or any expression that returns a string. |
INFO|ERROR|WARNING | An error message priority setting, where INFO, ERROR, and WARNING are priority levels:
|
Notes
The calculation script will stop executing when this function is called.
This function can only be used in calculation scripts; it cannot be used in member formulas.
Example
The following example stops the calculation and returns a custom warning message if maximum values specified in the IF statement are empty:
FIX("Actual") . "Profit"( IF( ("Marketing" < 0) OR ("Payroll" < 0) OR ("Misc" < 0) ) @RETURN( @CONCATENATE( @CONCATENATE("The violation of data integrity : Market [", @NAME(@CURRMBR("Market"))), "] has a negative expenses. Calculations are interrupted") , WARNING); ELSE "Profit" = ("Margin" - "Total Expenses")*0.9; ENDIF ) ENDFIX