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.)
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:
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.
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.
Select the Columns option under Output tab and provide the column definitions for the target.
Select the Mapping option under Output tab and provide the source to target mapping by drag and drop required columns to the target.
Open the Extended Properties of EmpID column under Columns of Output tab like below:
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:
Similarly for EmpName column and select the algorithm to generate the value like below:
Similarly for JoinDate column and select the algorithm ‘Use current date’ to generate the current date value like below:
Similarly for column Comtact and select the algorithm to generate the random values of limit 10 digits like below:
Save the job and Compile and run the job. After successful job run we can see the rows has been generated in target dataset.
After successful job run, View the data from the target Dataset. Here EmpID, EmpName, JoinDate and Contact has been generated.