Predefined elements

The Rule language provides:

Predefined Variables

About predefined Variables

The following table lists the available predefined variables where the:

  • Implicit type is a type that does not have a corresponding keyword and is specific to that predefined variable.
  • Scope is the type of the rule where the variable is defined.
  • Name Description Type Scope
    coll Current Business Collection Implicit All
    obj Current Business Object Object Control, Modify, Change Field, Transform*
    elt Current sub-Element Element Control, Modify, Change Field, Transform**
    ds Importer Datasource Implicit Transform
    context Import context Implicit Control, Modify

* When the rule type is Transform, elt is predefined only when the element path of the rule is an element (for example DOC/LN or DOC/LN/GL) and it represents the parent (root) object of the imported elements.

** When the rule type is Transform, elt is predefined only when the element path of the rule is of a sub-element of an element (for example DOC/LN/GL) and it represents the parent element of the imported elements.

Context variable specific role

The context variable is useful in the ControlImport rule-based functions and has two read-only properties: before and after. These properties specify the execution time of the ControlImport function. If the rule is executed before saving the current imported entity and also before importing the children of the current entity (function call with a “before” execution time), the before property is true. The same thing applies to the after property.

Consequently, the user can use the context variable as an import context where variables can be stored as properties of context. The scope of the properties of context variable is the whole import session.

Example

The following example checks the balance for each account in the imported file. An account is a business object. The operations are elements.

// rule1 on object level

if context.before then

context.balance = 0 // reset the context value

 

// rule2 on element level

if context.before and DIRECTION= ’C’ then

context.balance = context.balance + AMOUNT

 

// rule3 on element level

if context.before and DIRECTION = ’D’ then

context.balance = context.balance - AMOUNT

 

// rule4 on object level

if context.after and context.balance <> 0 then

newError(“err.balance”, “wrong balance %0”, context.balance)

Predefined Functions

The Rule language provides predefined functions that are not defined in a library. Although they can be defined in any rule, some functions cannot be used in rules of a specific type.

The functions are:

Related Links