I have DB with a master table with its detail table, let's say
Master (ID, MField1)
Det (ID, IDMaster, DetField1)
and I need to export a flat file with fixed column size, with both master rows and detail rows, here's below the records' structure:
Master Record:
Position Desc Length Default
1 RecordType 1 'M'
2 ID 10
3 MField1 10
Detail Record:
Position Desc Length Default
1 RecordType 1 'D'
2 ID 10
3 MasterID 10
4 MField1 10
For example, if I had 2 row in Master (1,'MFieldVal1'),(2,'MFieldVal2')
and 3 rows in Det (1,1,'DFieldVal1'),(2,1,'DFieldVal2'),(3,2,'DFieldVal3')
I'd export a file like this:
M 1MFieldVal1
D 1 1DFieldVal1
D 2 1DFieldVal2
M 2MFieldVal2
D 3 2DFieldVal3
So far I built a view which joins Master and Det, and I used it as the source of my dataflow, but I don't know how to create the header row before its details in the exported file.
How can I achieve this??