Executing Data Flow Item Tasks with parameters

This is the second post in a series focused on Data Flow development.

This post will show you how to create a parameterized Data Flow Item and execute it in a Data Flow. It’s a follow up to Creating and Deploying a custom Data Flow Item Class Library, so we’ll use the class library we created there. The way parameters are used, however, is exactly the same whether we use our own custom library or a built-in library.

Create the Data Flow Item

  1. In the Solution explorer, right click a node (Folder, Data Store, etc) and add a new Data Flow Item. Call it InfoTraxx Writer.
    This will open the Data Flow Item editor and the Data Flow Item explorer.
  2. In the Data Flow Item explorer, navigate to ResourceSets/Local Resource Sets, right click and add a new Resource Setdfi_new_resourceset
  3. Right click the newly created node, and add a New Assembly Reference
  4. In the editor, click Browse and select the InfoTraxx library. Note that you must have successfully registered the assembly in InVision in order for it to appear in the dialog. If you expand the Resource Set node after confirming the selection, you can see the new InfoTraxx Database API has been added.dfi_add_asmref
  5. Next, click the Tasks node in the explorer so that the Actions toolbox group (on the right) becomes enabled.
  6. Click the Actions toolbox group and you’ll see that our InfoTraxx Database API is available to us.
  7. Expand all the way down to the AddMessages method and drag and drop it onto the task list in the center of the screen.dfi_add_action

 

Configuring the [AddMessage] Task

After completing the steps above, we’ve created a task that can execute the AddMessage function we’ve implemented in our InfoTraxx database API library.
If you double click the [..].AddMessage task in the Tasks list or expand the Tasks node in the DFI explorer and select the AddMessage task node, the Task editor will open. The task editor is used for specifying during which phase the task should execute, the arguments to pass to the (task) function and optionally where the output should go.

dfi_task_infotraxx_addmsg

  1. Change the Execution Phase to Phase 1
  2. In the arguments editor, right click the Value cell and choose “Insert Parameter“.
    1. In the Name field, type “Message”
    2. Optionally, in the Caption field, type “Message”. This will be the display name of the parameter in the Data Flow and Workbook argument editors.

When inserting a parameter using the dialog, two things happen.
First, a new global Data Flow Item parameter is created and added to parameters list of the Data Flow Item. You can see all the DFI parameters by clicking the Parameters node in the DFI explorer.

dfi_parameters

Secondly, the parameter name (@[Message]) is mapped to the (message) argument. This way, when you pass an argument to the Data Flow Item when it’s being executed in a Data Flow, the argument will be passed on the the (AddMessage) function.

Note that you can do this manually by adding the parameter to the DFI parameters list and then typing the parameter name into the the arguments list of the function. It’s just a reference by name, so there’s nothing fancy going on here.

The AddMessage Task configuration should look like the image below, and we’re ready to execute the Data Flow Item.

dfi_infotraxx_addmg_conf

 

Executing the Data Flow Item

To execute the Data Flow Item, switch to the Solution Explorer

  1. Right click a node (folder, Data Store, etc) and select New Data Flow
  2. In the Data Flow editor, expand (or search) the Data Flow Items node in the Executables toolbox group and locate the InfoTraxx Writer Data Flow Item.
  3. Drag and drop it onto the Data Flow designer surface.
  4. Select the Data Flow Item in the designer surface. In the properties editor, enter a value for the Message parameter.dfa_infotraxx_writer
  5. Execute the Data Flow from the menu. If you have done everything correctly, the execution should succeed, and there should be a new entry in the Message table in the InfoTraxx database.

 

The next step

In the next post, we’ll execute the Data Flow from a Workbook and specify the message from there, instead of hard coding it in the property editor.