Requirement is below:
We have Source file emp.txt that
contain below data.
Id,Name,Sal,Dept_No
2,Swati,42000,20
3,Rupali,35500,10
4,Yash,50200,20
5,Kavita,80000,10
We want output file that
contains only dept_no =20 as out.txt
as below:
Id,Name,Sal,Dept_No
2,Swati,42000,20
4,Yash,50200,20
Step to perform this:
- In Repository Right Click on Job Designs and Select Create job.
- Give the name of the job, whatever is required and Click on Finish.Now we can see we have Active Design Area, and at the Left of Job Designs we have small Arrow or Plus symbol, that shows inside jobs.
- Click on that Arrow Symbol and Double Click on job. Now we can design job by using component.
- We can find all required Component from Top Right where we have Palette tab, Give the name of Component and press EnterAs by typing tfileInput, it will show all Component from list that contains that word.
For txt or csv file we use tFileInputDelimited Component.
- Drag Component at design area from Palette list.
- Double Click on Component, at belowwe can see properties of Component and change them.
- By Clicking on Edit Schema in Properties we can create schema that is required for our requirementAs we can see Initially Schema is blank. We can create column by Clicking Green + tab, and rename column as per requirement, just by selecting, and can set DataType and Length as well.In File name/ Stream we can provide the path of the input File.I am placing my Input File at Input Folder in C drivetlogRow Component is used to see output at any level in Job.
- Drag tlogRow component from Palette.To pass data from any component to any other Component, Right Click on that then Select Row, Click on Main and Finally move Cursor to next component then Click on that Component.
- Save job with CTRL+S, and to see O/P run the job by Clicking Run button from Top.
- Now to filter records for specific department no. we can use Component tFilterRow from Palette.
- Pass Main rows to Filter Component by previous component.
- Double Click to change component tFilter properties.
- Initially in Conditions block its blank. By Clicking + button we can add condition.
- Change the condition as per requirement, by choosing InputColumn name from drop down list. In Operator drop down we have conditions like(Equal, Not Equal, Greater ets). For Value we can set any Value. For decimal and doubal just put the value. For String we need to put value in quotes.(“value”).
-
- We can again put a tLogRow to see O/P.
- Now to store O/P in a txt file use Component tFileOutputDelimited from Palette. We just need to set path of output File.
- Run the job and we can see output file as required.We can deactivate tLogRow, just by Right Click on that component and Selecting Deactivate tLogRow, because it’s just to see result.
No comments:
Post a Comment