on 10-29-2015 3:34 PM
Hello experts,
My source data is H-1 H-1 H-1 H-1 L-1 L-1 L-1 L-1 L-1 L-1
H-1 H-1 H-1 H-1 L-2 L-2 L-2 L-2 L-2 L-2
H-2 H-2 H-2 H-2 L-2 L-2 L-2 L-2 L-2 L-2
where H is the header fields and L is the line item fields, so header and line item in one line
Now my requirement is such that
H-1 H-1 H-1 H-1
L-1 L-1 L-1 L-1 L-1 L-1
L-2 L-2 L-2 L-2 L-2 L-2
H-2 H-2 H-2 H-2
L-2 L-2 L-2 L-2 L-2 L-2
Header data in one line, and corresponding Line items in the next line,
How do i achieve this.
Thanks and regards,
Abhishek Biwal
Assuming your talking about input and output fiels, not database tables, correct?
A possible solution will depend on the format of your files. Simplest case will be with fixed file format.
1/. Define input file format with 2 fields: H and L.
2/. In a 1st data flow, read the file into a dataflow and load into a 3-column database table. 2 columns for H and L (make sure they are varchar of the same length!), the 3rd column will contain a sequence number restarting from 1 for every new value of H. Use gen_row_num_by_group(H) to that extent.
3/. In a 2nd data flow, read all distinct H values from the table. Write the results back into the same table, with a null value for L, and a zero value for the sequence.
4/. Define output file format with 1 field.
5/. In a 3rd data flow, read the table again, sort by H and sequence. Map H to output when seq = 0, L to output when seq <> 0, and write to file.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.