Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9129

Re: Output data in different lines for header and line item

$
0
0

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.


Viewing all articles
Browse latest Browse all 9129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>