@RETURN

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])
ParameterDescription

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:

  • INFO—The message indicated in the ErrorMessage string is sent back to the client and the application log as an informational type message. This is the default.

  • ERROR—The message indicated in theErrorMessage string is sent back to the client and the application log as an error type message.

  • WARNING—The message indicated in theErrorMessage string is sent back to the client and the application log as a warning type message.

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