Create your own predefined method - Connect_CDC - connect_cdc_mimix_share - 5 - 5.8

Connect CDC Advanced User Guide

Product type
Software
Portfolio
Integrate
Product family
Connect
Product
Connect > Connect CDC (MIMIX Share)
Version
5.8
Language
English
Product name
Connect CDC
Title
Connect CDC Advanced User Guide
Copyright
2023
First publish date
2003
ft:lastEdition
2023-09-27
ft:lastPublication
2023-09-27T18:12:55.651884

You can define a formal and explicitly-described expression, known as a procedure, to suit your site’s particular requirements. A procedure is a complex expression (built with programming statements) that you CREATE with an internal procedure name and with an explicit input parameter list (source columns are not referenced by name).  

You also supply an external name for the procedure. This is its display name in the Connect CDC Director, and it may be the same as its internal procedure name but may be different.

Note: This name cannot be the same as any other data enhancement method, whether one you created or one of Connect CDC’s built-in methods. One way to do this is to append some identifying tag such as company initials to the beginning of all method names. All Connect CDC’s new methods are coded in lower case so you also could avoid conflicts by using mixed-case names, which are supported.

To access the Connect CDC Director interface with which you define your procedure, from the context menu of the Data Enhancement Methods branch of your model, select New Data Enhancement Method > New Compiled Method:

In the tabs of the Data Enhancement Methods Properties dialog box, you provide the Connect CDC Director with identifying information for your procedure, and you specify the actual procedure code.

 

To enter the new compiled method:

  1. In the Name text box, enter a unique name which will identify this compiled method in the Connect CDC Director. The name can have as many as 32 characters.

  2. In the Return type list, select the datatype of the value to be placed in the target table. Be sure to enter a return type.

  3. Enter the greatest possible length of a return value, that is, the total number of digits, in the Length box. For example, if you are converting Fahrenheit to Celsius temperatures, enter 3.

    Length is not available for all datatypes.

  4. Enter the Scale, if applicable. Scale is the number of digits to the right of the decimal point in a number. Scale is not available for all datatypes.

  5. For each input parameter, enter a name, datatype, and precision (the number of digits in the number).

    You can specify zero, one, or more input parameters, each to be represented by a column in your source table, a constant, or a system variable.

    To specify multiple parameters, use the Add button. To rearrange the order of parameters, use the Move up and Move down buttons. To delete a parameter, use the Delete button.

  6. On the Compiled tab, you must enter the Function name to be used with this method. The name must be a valid Java identifier. It must begin with a letter, underscore (__), or dollar sign ($).

Note: If you do not enter a Function name, the procedure on the Body tab will not be correct.If you want to change an item on the Basic or Compiled tabs, you must delete/erase everything from the Body tab first and then proceed.

The Body tab contains executable code. The input parameters you entered on the Basic tab fill in here automatically. You can write your own procedure here from scratch, if required.

These procedures are named, complex, expressions. The rules for specifying them are:

  • The first statement must be a procedure statement, containing:

    • name of the procedure

    • list of input arguments (a void or empty argument list is allowed)

    • "returns" clause, which indicates the type of the return value.

    • Column references are not allowed within the body of the procedure. The current row is not an implied input; you must explicitly define the input parameters that are required.

    • The following programming statements are allowed:

  • Variable declaration ("declare type variable name;")

  • Assignment

  • if / else

  • "switch / case / default"

  • "while"

  • "do"

  • "for"

  • "break" and "continue"

  • "return"

  • blocks, where multiple statements can be grouped within left and right braces. Anywhere a single statement can be used, a block of statements can be specified.

    • Statements must be terminated with a semi-colon (;).

    • The last statement must be an "end;" statement.

To write your own procedure:

  1. Enter your code, observing the rules for procedures.

  2. Click the Validate button to verify the syntax of your procedure. At a minimum, the procedure requires a return statement between the procedure and end statements in order to validate.

  3. Once the procedure is valid, click OK to complete the creation of the compiled method.

The compiled method is now available in the Method column on the Table Properties, Mapping tab of a source or target table. You can use this compiled method to map data from one or more source columns to any target column for which you want data converted.

When you complete a valid definition, your user-defined procedure is available to be selected from:

  • Data Enhancement Methods branch of your model

  • Method lists on table Properties, Mapping tabs and on the Target Column Expression tab.

Define a user (named) procedure only in the context of a procedure expression. You cannot enter a user procedure in either of the following:

  • Sending Table Properties, Gate Condition tab

  • Result expression box in the Target Column Expression tab that you see when you select the Expression Method for a target column in the Mapping tab of the Sending Table Properties dialog box and then click Edit Source.