Expressions and Functions

An expression enables you to perform the following in the Value/Expression field:

  • Execute a simple math equation.

  • Use a CURVAL parameter to specify the value of a logic account operation. The CURVAL parameter can be used within expressions, as it can within logic functions, except that, with expressions, CURVAL must be enclosed in pipes. For example, the CURVAL expression includes the specification of an account using the notation of |Account| and the specification of a value using POV details of entity, category, period and account.

Functions enable the use of simple logic with if/else using Jython syntax. Jython commands can be used in a function and can be more complex than an expression.

Exp

Use Expression operators to execute custom logic expressions, which are defined in the Value/Expression field. Logic expressions, which cannot use variables or If statements, are simpler than logic functions. Except for |CURVAL|, expressions do not have built-in parameters. For expressions, you do not need to assign a value to RESULT.

Expressions execute faster than logic functions. You can use the Data Management Lookup function within expressions, as it is used within logic functions. To write a custom expression, double-click the Value/Exp field to open the expression editor.

|CURVAL| + |810| + |238|

The function above uses the Data Management Lookup function to add two source accounts to the value of the logic account. Notice that the CURVAL parameter can be used within expressions, as it can within logic functions, except that, with expressions, CURVAL must be enclosed in pipes.

(|CURVAL| + |000,10,09/30/01,810|) * 100

The function above uses the Data Management Lookup function to add a source account (810) and a source account from a specified center, Data Management category, and Data Management period to the value of the logic account, and then multiplies the resulting sum by 100.

Function

Use function operators to execute a custom logic function defined in the Value/Expression field.

To write a function, select Function from the Operator drop-down list in the Logic Item line, and then click the edit icon to open the edit window. Logic functions are usually used for conditional mapping and other complex operations that involve multiple source accounts. Logic functions enable the use of Jython commands including variables, if/elif/else statements, numeric functions, and other Jython constructs.

The logic function enables the use of predefined function parameters, and also requires that you assign a value to the RESULT variable so that a value can be updated for the newly created logic account. The following function parameters can be used in a logic function, and these do not require using the "|" notation:

Table 4-22 Function Operators and descriptions

Function Operator Description
CURVAL Source value of the logic account operation
StrLocation Active location name
StrCenter Logic account entity
StrCatKey Active category key, not the name. You need too lookup the category key in the database to use this parameter.
StrPerKey Active period
Entity, Category, Period, Account| Lookup notation may be used in a logic function. This is the same notation provided in the logic expression.
Skip If "Skip" is assigned to the keyword RESULT, then the logic account is not created.

You can define function parameters in uppercase, lowercase, or mixed case letters. However, the keyword RESULT must be in uppercase letters.

Assigning Function Return Values

The result of a Logic Function must be assigned to the keyword RESULT. If a return value is not assigned to the RESULT keyword, then the logic engine automatically sets the value of result to zero. This causes the calculation to be skipped and the logic account is not created.

The following function assigns the result of the logic account calculation (using the CURVAL parameter) to the logic account (RESULT) when the logic account calculation returns a value greater than zero. If the first condition is not met, then the logic account is not created because of the keyword "Skip".

if CURVAL > 0:
   RESULT = CURVAL
else:
    RESULT = "Skip"

Note:

You must use the Jython notation and indentation for the logic function.

The following function only assigns the result of the logic account calculation to the logic account when "10" is the active Data Management category key.

if StrCatKey == "10":
    RESULT = CURVAL
else:
    RESULT="Skip"

This function assigns the result of the logic account calculation to the logic account only when the Criteria Account Entity is "000."

if StrCenter == "000":
    RESULT = CURVAL * 100
else:
    RESULT="Skip"

This function uses the Data Management Lookup function to add a source account (810) to the value of the logic account if the current Data Management period is "Dec 2013".

if StrPerKey == "12/31/2013":
    RESULT = CURVAL + |810|
else:
    RESULT="Skip"

This function uses the Data Management Lookup function to add another source account from a different Entity, Data Management category, and Data Management period to the value of the logic account when the active location is "Texas".

If StrLocation == "Texas":
    RESULT = CURVAL + |000,10,09/30/13,810|
else:
    RESULT="Skip"