Skip to main content
OnCommand Workflow Automation 5.0
A newer release of this product is available.

Create a function

Contributors

You can create a WFA function that can be used as a utility, if there is no predefined WFA function that is suitable for your task.

What you'll need

You must know MVFLEX Expression Language (MVEL) syntaxes to create a function.

About this task

You must include the following for the function definitions:

  • Name: name of the function

    You must not use a reserved word in MVEL syntax. Each function must have a unique name.

  • MVEL definition: a string specifying the MVEL syntax of the function definition

Steps
  1. Click Designer > Functions.

  2. Click New icon on the toolbar.

  3. In the New Function dialog box, enter or select the required details in the Function description and Function definition fields.

    Example

    def actualVolumeSize(data_size, snap_pct)
    {
       if (snap_pct < 0 ) {
            snap_pct = 0;
       } else if (snap_pct > 99) {
            snap_pct = 99;
       }
    
       div = 1 - (snap_pct/100);
       return (int)(data_size/div);
    }

    The Function name field is populated from the data that is used in the MVEL syntax.

  4. Optional: Click Test to test the function:

    1. In the Expression section of the Test dialog box, enter the required expression of function.

      Example

      actualVolumeSize(600, 1)

    2. Click Test.

      The test result is displayed.

    3. Close the dialog box.

  5. Click Save.