Custom Functions

About_Custom_functions

Conventions

Using_custom_functions

Check_operations

Dependencies

Custom_functions_behavior

Rights_management

About Custom functions

Custom functions enable you to improve your use of the DML language. You can package DML expressions that are complex to define and are often used in mappings, for example the account number check related to internal tables or exit calls.

These new objects contain the list of settings and the expression that they will represent. You can create, update, delete them and use them in objects from any folder.

You can call a custom function from a mapping expression in the:

  • Transformation Rules - financial cases conditions, generation conditions, mapping expressions
  • Enrichment Rules - generation conditions, mapping expressions
  • Mapping templates - generation conditions, mapping expressions
  • Pre-calculation definitions - conditions, mapping expressions

Restrictions:

  • A custom function is not allowed to call another custom function.
  • If you use the $ +shortcut (Ctl+SHIFT+SPACE) inside a custom function expression, the list of DML functions will not include any of the custom functions.

Conventions

The name of the custom function and the names of the parameters must respect the following rules:

  • The name can contain up to 50 characters.
    • Numbers from 0 to 9
    • Letters A to Z, a to z
    • The underscore character ( _ ), same rule applies as for the variable name.
  • The name must not contain only digits or only underscore characters.
  • The name must not begin with the “SYS” prefix.
  • All custom functions and parameters must have a unique name and not take the name of:
    • Table functions: CHECKTAB, CHECKTABD, ACCTAB, ACCTABD, EXTTAB, EXTTABD
    • Predefined DML functions: NBDAYS, JULIAN, SYSDATE, DATEPLUS, DATEMINUS, DAY, MONTH, YEAR, YEAR4, SEARCH, CHECK, ERR, NULL, ENV, INT
    • Language reserved words: IF, THEN, ELSE, NUMERIC, AND, OR, LOW_VALUE, HIGH_VALUE

The custom expression can:

  • Contain up to 1200 characters for expressions or 500 characters for conditions.
  • Be a DML expression or part of an expression that follows the lexical and syntax rules of the DML grammar.
    The limit of the extended expression (the Custom function call is replaced by its own expression with the real parameters) is 1200 characters in an expression or 500 characters in a condition.

Using custom functions

The custom function is available in the custom function section when the DML browser is launched.

To add a new custom function:

  • Right-click the custom function node.
  • Drag and drop the custom function into any expression field from where it can be used.

Except the fact that it can be defined starting from other functions, the custom functions behave exactly like any other function.

Check operations

When you modify a custom function, all the objects that use that custom function are impacted. If these objects were in the “checked” status, the status is set to “to be checked”. However the Mapping-Template object is an exception as the check on this object does not imply a check on the custom functions that it uses. Eventual errors are displayed only when a Mapping Template is used in a Transformation Rule and a check is performed on the Transformation Rule.

You can call the custom function from a mapping expression in the:

  • Transformation-Rules (Financial-Cases conditions, generation conditions, mapping expressions)
  • Enrichment-Rules (generation conditions, mapping expressions)
  • Mapping-Templates (generation conditions, mapping expressions)
  • Pre-calculation definitions (conditions, mapping expressions)

If an object uses a custom function, the check operation on the objects includes also the custom function. If an error is detected when the custom function is checked, then the object that uses the custom function cannot be checked.

All the errors issued at checking time are displayed in the Log Navigator, and the object remains unchecked.

Restriction: When a custom function that uses Table objects or Variable objects is checked, the check operation does not verify if the objects exist in the repository. For all other objects, it is performed when the object is checked.

Dependencies

The custom function is a folder independent object, that can be used in all objects that have DML expressions, just like any predefined DML function.

When used in a DML function, after the “check” operation, a link is built between the two objects. This link is a reference type link , that means that it has no status impact between the two objects. However, when performing recursive check on an object that uses a custom function, the function is also checked.

The link between the objects is not displayed in the Dependency Browser, as although the custom functions are considered as objects, they are processed like the other functions.

Custom functions behavior

Import/Export

When you import/export an object that uses a custom function, the custom function is also imported/exported.

Send to server

The expression from the definition of the custom function is sent to the server in the:

  • Pre-calculations definitions and conditions
  • Transformations-Rules mapping sentences
  • Enrichment-Rules mapping sentence
  • Scenario conditions

When the expression is sent to the server, the Custom function calls are replaced by their own expression with the real parameters. If a custom function is used inside a Rule, and this Rule has been sent to server, then the custom function remains in checked status. Before modifying a custom function, any rule that uses it must be removed from the server. Modifying a custom function used by a rule that has been sent to server creates an inconsistent state for the rule. Use the Commit action to force a sent-to-server.

If an error is detected at send to server time, the operation fails and the error is displayed in the send to server log.

All the custom functions are replaced with their actual expressions in the mvt.mvt file.

Rights management

Create, delete, update actions are restricted to users with the corresponding rights.

Related Links