What is router transformation in informatica

Create dynamic parameter files and upload parameter values

In this blog I am going to explain how to dynamically generate parameter files using a CSV file as input and a parameter file as output. We will also look at how to update the parameter values ​​in the parameter file for a specific session or workflow.

Step 1:

Let's start with generating the parameter file. Here we use CSV as input and store the required information like folder names, workflows, worklets, sessions, parameter names, parameter values ​​and the number of parameters. Here is a sample CSV file we used to generate the parameter file:

Step 2:

Now import the source and target files and create a mapping.

Source: CSV file

Target: parameter file

The target file is limited. Click the Advanced button to remove double quotation marks.

Under Optional Quotation Marks, select None.

Based on the number of parameters, we create multiple flows using the router transformation.

In the following picture we have created two groups:

1. For the workflow with a single parameter.

2. For the workflow with two parameters.

There are basically two sections in the parameter file: headers and parameters. In the expression transformation we have additional ports (number of parameters +1 additional ports). For example, in the following figure we have three ports: one for headers and two for parameters.

Code to generate the header. This will create a dynamic header based on the values ​​specified in the CSV file.

Code for parameter 1.

Code for parameter 2.

The normalization transformation converts columns to rows.

If we have a parameter for a workflow, the occurrence is 2 (n + 1).

Here we have two parameters so we used 3 occurrences.

When using the union transformation, the records are merged.

Step 3:

As soon as we run the workflow, the parameter file is generated.

Now update the parameter file for a workflow or a session:

1. Update the CSV file and generate the parameter file

Since we are using flat files to store the information, updating it may not be easy. So we generate a new file with the latest values ​​and replace it with an existing file. For example we have the CSV1.csv file, then we generate CSV2.csv with the latest values ​​(for this WF / session) and later we remove CSV1.csv and rename CSV2.csv to CSV1.csv.

Source: CSV1.csv

Target: CSV2.csv

Add a new port in the expression editor and use the following code to update for specific workflows only.

After the workflow has been run, the CSV2.csv file is generated. In the workflow, add the command task and use the following code to move and replace the CSV file.

Command 1: Move D: \ Informatica \ 9.0.1 \ server \ infa_shared \ TgtFiles \ CSV2.csv. D: \ Informatica \ 9.0.1 \ server \ infa_shared \ SrcFiles

Command 2: del D: \ Informatica \ 9.0.1 \ server \ infa_shared \ SrcFiles \ CSV1.csv

Command 3: Rename D: \ Informatica \ 9.0.1 \ server \ infa_shared \ SrcFiles \ CSV2.csv CSV1.csv

After updating the CSV file, run the parameter workflow with CSV1.csv as input, which will generate a parameter file with updated values.

Ask? Contact us!