Column Generator Stage Example

The Column Generator stage is a Development/Debug stage.

The Column Generator Stage has single input link and a single output link.

The Column Generator stage adds columns to incoming data and generates mock data for these columns for each data row processed. The new data set is then output. (See also the Row Generator stage which allows us to generate complete sets of mock data, Row Generator stage.)

Example:

In below example we are having Employee details in a sequential file as an input and needs to be copied to a Dataset.

Follow below steps:

Design your job same as shown below:

dsJob 2 - Column Generator Stage Example

Input Data:

Here, we are having some Employee data in a sequential file as an input. As we can see here we don’t have appropriate data like EmpID or Contact details of employee, so we are going to add some mock data for employee.

ColInputdata 1 - Column Generator Stage Example

Open the Properties window of Column generator stage by double click on it or select properties from drop down by Right Clickàselect Properties to open it and Under Output tab, select Properties and select option ‘Column To Generate’ as per our requirement like below. Here we are going to have below columns ‘EmpID’, ‘EmpName’, ‘JoinDate’ and ‘Contact’ and we need some mock data in it.

1 3 - Column Generator Stage Example

Select the Columns option under Output tab and provide the column definitions for the target.

3 2 - Column Generator Stage Example

Select the Mapping option under Output tab and provide the source to target mapping by drag and drop required columns to the target.

2 3 - Column Generator Stage Example

Open the Extended Properties of EmpID column under Columns of Output tab like below:

8 1 - Column Generator Stage Example

Under the Extended Properties of EmpID column select the algorithm to generate the value like Cycle having initial value as 1000 and incrementing by 1 as below:

4 1 - Column Generator Stage Example

Similarly for EmpName column and select the algorithm to generate the value like below:

5 2 - Column Generator Stage Example

Similarly for JoinDate column and select the algorithm ‘Use current date’ to generate the current date value like below:

6 1 - Column Generator Stage Example

Similarly for column Comtact and select the algorithm to generate the random values of limit 10 digits like below:

7 1 - Column Generator Stage Example

Save the job and Compile and run the job. After successful job run we can see the rows has been generated in target dataset.

col Output - Column Generator Stage Example

Output Data:

After successful job run, View the data from the target Dataset. Here EmpID, EmpName, JoinDate and Contact has been generated.

col Outputdata - Column Generator Stage Example