Defining a custom function

About this task

To define or create a custom function:

Procedure

  1. Select the Functions tab. In the Function tab, the list of standard functions is displayed. In addition, the Actions pane opens.
  2. To display the Custom Function dialog box, choose from one of the following options:
    • Right-click the Custom Functions node in the Functions tab and from the menu select Add New Custom Function... .
    • In the Actions pane, select Add New Custom Function.

      The Custom Function dialog box opens.

  3. In the Function Name field of the Custom Function dialog box, enter a valid JavaScript name for your custom function.
    Note: This name must be unique for all custom functions in the current project. The name of the function is not case sensitive - the case of a character is not considered. For example the function name: Aaa is equivalent to the function name: AAA.
  4. Select a Return Type for your custom function from one of the following options:
    • string
    • number
    • boolean
    For more information about these datatypes, see Custom Function Parameter and Return Datatypes.
  5. Define the parameters for your custom function. Repeat the following steps for each parameter in your custom function:
    1. Click Add.
    2. In the Name field of the Parameters table, enter the name of the parameter and press the Return key.
    3. Select a Type for the parameter, from one of the following options:
      • string
      • number
      • boolean
    4. For more information about these datatypes, see Custom Function Parameter and Return Datatypes.
  6. Enter the source code for your custom function by following these steps:
    1. Click Next.
    2. In the white area displayed between the braces enter the JavaScript code of your custom function.  
    3. Click Compile. The syntax of the function will be checked and any errors reported. The location of the errors are highlighted in red in the source code.
    4. Fix any syntax errors and once the function compiles successfully, click OK and then Finish.

Results

The custom function is now available from the Custom Functions folder of the Functions tab.



Feedback | Notices


Timestamp icon Last updated: Tuesday, 27 September 2016


http://pic.dhe.ibm.com/infocenter/wci/v7r0m0/topic/com.ibm.wci.doc/defining_a_custom_function.html