IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Dual input CSV (hdr / det) to flat structure Options · View
Julian
Posted: Wednesday, February 24, 2021 1:21:32 PM
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):
Mapping.JPG

wriley
Posted: Thursday, February 25, 2021 7:23:30 PM
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.



Julian
Posted: Monday, March 8, 2021 2:06:56 PM
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/AnMQqK296WM0

No 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.
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.