@RETURN

The @RETURN calculation function exits a calculation script based on logical error conditions you specify. This function exits the calculation immediately when the condition is met. You can customize the error messages and priority levels (INFO, ERROR, and WARNING).

You specify the error conditions in an IF... ELSEIF command block. Upon exit, Essbase returns the error message you specified.

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