@RETURN

The @RETURN calculation function exits an Essbase calculation and returns a message, based on given conditions.

This function exits the calculation immediately, returning a message, under specified logical conditions. You can use an IF... ELSEIF command block to specify the error conditions, and use @RETURN to exit the calculation with customized error messages and levels.

Syntax

@RETURN ("ErrorMessage", [,INFO|ERROR|WARNING])

Parameters

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 the ErrorMessage string is sent back to the client and the application log as an error type message.

  • WARNING—The message indicated in the ErrorMessage 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