This example demonstrates how to insert records into the file
Question from the customer
I have the following file
HEAD01,Line1
HEAD01,Line2
HEAD02,Line4
HEAD02,Line5
HEAD03,Line3
I want to create a file with the header and line as below:
HEAD01
Line1
Line2
HEAD02
Line4
Line5
HEAD03
Line3
The solution
Note: this example is based on 0025 Merge Header and Lines file
How it works
- The first transformation adds the header number field
- Next transformations add RN fields to data, 1 for header and 2 for lines.
- Data is merged using union transformation.
- Data is sorted using F2 and RN fields
- The result is written into the target file
To view the example follow the steps below
- Download and install Advanced ETL Processor [Link]
- Download and Unzip example[Link]
- Create a new transformation and open the .ats file
- Double-click on the Reader object and amend the source file path
- Double-click on the Transformer object
- Double-click on the Lookup object and amend the source file path
- Double-click on the Writer object and amend the target file path
- Press the green arrow to run the transformation
Please contact us if you need help with transforming the data
Visit ETL Tools Forum |