Rank: Newbie
Joined: 6/11/2015 Posts: 8 Location: UK
|
Hi
I have a fairly standard CSV input scenario - header file, detail file. I just need to combine both into an equally simple flat structure (ultimately outputting to fixed width format).
HEADER KEY1,KEY2,HDR01,HDR02,HDR03 1001,A000,Hfield1a,Hfield2a,Hfield3a 1001,B000,Hfield1b,Hfield2b,Hfield3b 1002,A000,Hfield1c,Hfield2c,Hfield3c 1003,D000,Hfield1d,Hfield2d,Hfield3d 1003,E000,Hfield1e,Hfield2e,Hfield3e
DETAIL KEY1,KEY2,DET01,DET02,DET03 1001,A000,Detfield1a1,Detfield2a1,Detfield3a1 1001,A000,Detfield1b2,Detfield2b2,Detfield3b2 1001,A000,Detfield1c3,Detfield2c3,Detfield3c3 1001,B000,Detfield1a4,Detfield2a4,Detfield3a4 1001,B000,Detfield1b5,Detfield2b5,Detfield3b5 1002,A000,Detfield1a6,Detfield2a6,Detfield3a6 1002,B000,Detfield1a7,Detfield2a7,Detfield3a7 1003,D000,Detfield1a8,Detfield2a8,Detfield3a8
COMBINED KEY1,KEY2,HDR01,HDR02,HDR03,DET01,DET02,DET03 1001,A000,Hfield1a,Hfield2a,Hfield3a,Detfield1a1,Detfield2a1,Detfield3a1 1001,A000,Hfield1a,Hfield2a,Hfield3a,Detfield1b2,Detfield2b2,Detfield3b2 1001,A000,Hfield1a,Hfield2a,Hfield3a,Detfield1c3,Detfield2c3,Detfield3c3 1001,B000,Hfield1b,Hfield2b,Hfield3b,Detfield1a4,Detfield2a4,Detfield3a4 1001,B000,Hfield1b,Hfield2b,Hfield3b,Detfield1b5,Detfield2b5,Detfield3b5 1002,A000,Hfield1c,Hfield2c,Hfield3c,Detfield1a6,Detfield2a6,Detfield3a6 1003,D000,Hfield1d,Hfield2d,Hfield3d,Detfield1a8,Detfield2a8,Detfield3a8
Note the excluded records (header rec 5 & detail rec 7) where there is no match between files.
I have a solution (attached), but was wondering if there is a more efficient / "better" method?
Any comments or suggestions gratefully received, thanks in advance.
Julian Julian attached the following image(s):
|
Rank: Member
Joined: 2/3/2016 Posts: 17 Location: Plymouth, Michigan
|
Julian,
You may want to try this with the Join Component, it may lend itself to this well.
It is covered pretty well in the help file, and for a quick review here is a link to a screen shot to part of the help section about it.
https://www.screencast.com/t/AnMQqK296WM0
No guarantee it is the path forward but worth a look I think.
|
Rank: Newbie
Joined: 6/11/2015 Posts: 8 Location: UK
|
wriley wrote:Julian, You may want to try this with the Join Component, it may lend itself to this well. It is covered pretty well in the help file, and for a quick review here is a link to a screen shot to part of the help section about it. https://www.screencast.com/t/AnMQqK296WM0No guarantee it is the path forward but worth a look I think.
Apologies - I did omit to say that this must be a C# compiled solution - therefore JOIN cannot be used. I did initially look at that. Thanks.
|