Create Custom Functions

Phase one: Create or import the Custom Function code

Phase two: Create the Custom Function object in Mapping Services

Phase three: Reference a Custom Function from a DML expression

Phase one: Create or import the Custom Function code (C and Java functions only)

  1. To create a Develop a Custom Function in C or a Develop a Custom Function in Java, write the function code in C or Java.
  2. Alternatively, select a prebuilt C or Java function provided by Axway.
  3. (For SQL functions, you define the Custom Function entirely in Mapping Services.)
  4. Deposit the C or Java Custom Function on the execution server in the folder:
  5. $CORE_LOCAL\config\runtime\mappingcomponent\running\Generated\Function

Phase two: Create the Custom Function object in Mapping Services

  1. In Mapping Services, to create the Custom Function object, select File > New > Integration > Custom Function.
  2. Mapping Services opens the Custom Function definition window.
  3. Complete the General tab
Field Contents

Name

Enter a name for the Custom Function that is unique in the folder where you create it. This name is the logical name that is used to reference the Custom Function from DML expressions. The name of the function must begin with an upper case letter. For example: MyFunction.

Label

Enter an optional free-text description of the Custom Function. This description appears only on this tab.

Status

This field displays the current status of the Custom Function, set to ToBeChecked by default. You cannot directly change the status in this field.

Category

From the drop-down list, select the type of Custom Function you want to define.

Class

Select the of the value that the Custom Function returns. This field is mandatory. You can choose from among the following classes:

  • Boolean
  • String
  • Integer
  • Real number
  • Data and Time
  • Very Large Object

Class name

[For Java functions only]

Enter the name of the Java class that defines the function.

Method name

[For Java functions only]

Name of the method that executes the function.

Use Channel

[For Java functions only]

From the drop-down box select one of the following options:

  • None (default)
  • SAP: Select this option if the function requires a connection to retrieve a value from SAP via the RFC interface
  • JDBC: Select this option if the function requires a connection to a data base via a JDBC Channel
  1. Complete the Parameters tab
  2. The Parameters tab, displays a table in which you define and view the parameters of the Custom Function. The Parameters table contains a line for each parameter. You can add a maximum of 128 parameters to a Custom Function.
  3. To add a new parameter to the table, click Add line icon and complete the table columns.
Column Contents

Name

Enter a name for each parameter that you define. Although a parameter is not an object, follow the object naming conventions. Each parameter name in a Custom Function must be unique.

Label

Enter a description of each parameter. Although a parameter is not an object, respect the conventions for describing objects. This description is optional and appears only on this tab.

Class

Select the of the data that the parameter can contain. The of the parameters for Database Functions must be String.

Via String parameters, you can use DML to pass any value to a Custom Function. For example, the parameter can be a Business Document path that contains an integer (/segment Name/leaf element name) or a Mapping Services Variable that stores Real numbers (%MyVariable%).

  1. For SQL Functions you also complete the Implementation tab.
  2. Mapping Services displays the Implementation tab of the Custom Function Properties view only when you select the SQL value for the Category field of the General tab.
  3. The Implementation tab comprises a single field in which you enter an SQL SELECT statement to retrieve a single value from a table.
  4. Use the syntax:
  5. Select col1, col2 from mytable where col3=#param0# and col4=#param1#
  6. To refer to the function parameters, place them between hash ("#") characters.
  7. You can enter only one SELECT expression in the Implementation tab. Multiple expressions are not authorized.
  8. The maximum length for an expression is 5000 characters.
  9. When you check the Custom Function object, Mapping Services verifies the syntax of the expression you enter in the Implementation tab. However, this syntax validation is only formal. That is, Mapping Services does not perform an exhaustive check of grammar for all SGBDs. There is no check for the existence of the tables and columns referred to in the expression.
  10. In Mapping Services, open an Integration Process object and locate the DML expression in which you want to use the Custom Function. Drag-and-drop the Custom Function from the Mapping Manager panel to the DML expression.
  11. When the Integration Process and related objects are complete, send the Integration Task to the execution server. For C and Java functions, the Send to Server command is only successful if the function is present on the destination Map Engine.

Phase three: Reference the Custom Function from a DML expression

  1. In Mapping Services, display the DML expression field in which you want to refer to a Custom Function.
  2. Open the folder that contains the Custom Function you want to refer to.
To open a folder in... Perform the following...

Current WorkFolder

On the Mapping Manager tab, double-click the Custom Function folder. Mapping Services displays the list of Functions that are available in the current WorkFolder.

You can also access Functions via the DML Object Browser:

  1. On the Tools menu, select DML Object Browser. Mapping Services opens the DML Object Browser and displays the DML Function, Custom Function, Variable, and Table folders.
  2. Double-click the Custom Function folder.
    Mapping Services displays the list of Functions that are available in the current WorkFolder. Mapping Services prefixes the name of the Entity and Folder to the name of each Custom Function.

another Folder

  1. On the Tools menu, select Entity Browser. Mapping Services opens the Entity Browser and displays a list of Libraries that are in the local Entity.
  2. Double-click the Folder that contains the Custom Function you want to use. Mapping Services displays the Custom Function, Variable, and Table folders.
  3. Double-click the Custom Function folder. Mapping Services displays the list of Functions that are available in the selected Folder.
  1. Select the Custom Function that you want to use.
  2. Drag-and-drop the Custom Function to the appropriate field. Mapping Services adds the name of the Custom Function to the field. If the Custom Function does not belong to the current WorkFolder, Mapping Services prefixes the name of the Folder to the name of the Custom Function: Folder_Name.CustomFunction_Name.
  3. The Custom Function is now referenced in an expression.
  4. On the Parameters tab, define the parameters of the Custom Function.
  5. The Parameters tab, displays a table in which you define and view the parameters of the Custom Function. The Parameters table contains a line for each parameter. You can add a maximum of 128 parameters to a Custom Function.
  6. To add a new parameter to the table, click Add line icon and complete the table columns.
Column Contents

Name

Enter a name for each parameter that you define. Although a parameter is not an object, follow the object naming conventions. Each parameter name in a Custom Function must be unique.

Label

Enter a description of each parameter. Although a parameter is not an object, respect the conventions for describing objects. This description is optional and appears only on this tab.

Class

Select the class of the data that the parameter can contain. The data class of the parameters for Database Functions must be String.

Via String parameters, you can use DML to pass any value to a Custom Function. For example, the parameter can be a Business Document path that contains an Integer (/segment name/leaf element name) or a Mapping Services Variable that stores Real numbers (%MyVariable%).

Related topics

Use Custom Functions

Related Links