Previous Topic: Test the Custom Operator InterfaceNext Topic: Custom Operator: Preview Tab


Example: Retrieve Valuemap Array Values with an Operator System Function

This example uses the following operator system function to retrieve the values of a valuemap array. The function returns one field or column from an array that is based on the provided parameters.

getValueFromValueMapArray(groupName, arrName, fieldName, fieldValue, requiredFieldName)

Follow these steps:

  1. Create a custom operator named CustOp_GetDBVersion with Get Version as the base operator.
  2. Design the form as the following illustration shows:

    Name the form elements as mNamedConnection, mHostName, mUserName, mPassword, mPort, mDBName, mDBType, and mDriverName. Ensure that the form elements names are similar to the variable names defined in the Group Configuration tab.

  3. Click the Settings tab and create a group named NamedConnectionGroupDemo.
  4. Click the Custom Operator Pre-execution tab and enter the following code:
    Process.HostName = getValueFromValueMapArray("NamedConnectionGroupDemo", "ConnArray", "mNamedConnection", Operator.mNamedConnection, "mHostName");
    Process.UserName = getValueFromValueMapArray("NamedConnectionGroupDemo", "ConnArray", "mNamedConnection", Operator.mNamedConnection, "mUserName");
    Process.Password = getValueFromValueMapArray("NamedConnectionGroupDemo", "ConnArray", "mNamedConnection", Operator.mNamedConnection, "mPassword");
    Process.Port = getValueFromValueMapArray("NamedConnectionGroupDemo", "ConnArray", "mNamedConnection", Operator.mNamedConnection, "mPort");
    Process.DBName = getValueFromValueMapArray("NamedConnectionGroupDemo", "ConnArray", "mNamedConnection", Operator.mNamedConnection, "mDBName");
    Process.DBType = getValueFromValueMapArray("NamedConnectionGroupDemo", "ConnArray", "mNamedConnection", Operator.mNamedConnection, "mDBType");
    Process.DriverName = getValueFromValueMapArray("NamedConnectionGroupDemo", "ConnArray", "mNamedConnection", Operator.mNamedConnection, "mDriverName");
    
  5. Select the Group Configuration tab and click Lock to lock the group.
  6. Create a valuemap array named ConArray and add the parameters shown in the following illustration:

  7. Click Save Configuration to save the group configuration.
  8. Click Unlock to publish the NamedConnectionGroupDemo group at the Domain and Environment level.
  9. Open the group from the Configuration Browser, Modules tab.
  10. Add the parameter values to the array as the following illustration shows and save the array.

After the valuemap array values are retrieved, a production user can use the NamedConnectionGroupDemo operator in a process to reference a named connection.

  1. Create a process that uses the CustOp_GetDBVersion custom operator.
  2. Provide "mysql" as the connection field value in the custom operator properties to retrieve the related values from the array ConArray.
  3. Run the process.

    The script in the custom operator pre-execution code runs. The process retrieves the values for the "mysql" connection field value entered in the named connection property and displays it in the Dataset palette.