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.

How to Produce a Conditional Insert using Text Files.. Options · View
DKPT
Posted: Tuesday, December 21, 2010 4:19:12 PM
Rank: Newbie

Joined: 12/21/2010
Posts: 1
Hello,
I am new to Mapforce tool. I have 2 text input files like below

1.Text1.txt looks like
HDR,100,xxx,xxx,xxx,xxx,xxx,xxx,xxx
DTL,100,xxx,xxx,xxx,xx,xx,xxx,xxx,xxxx,xxx,xx,xxx,
RSN,100,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx
HDR,200,xxx,xxx,xxx,xxx,xxx,xxx,xxx
DTL,200,xxx,xxx,xxx,xx,xx,xxx,xxx,xxxx,xxx,xx,xxx,
RSN,200,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx
RSN,200,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx
RSN,200,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx
HDR,300,xxx,xxx,xxx,xxx,xxx,xxx,xxx
DTL,300,xxx,xxx,xxx,xx,xx,xxx,xxx,xxxx,xxx,xx,xxx,
RSN,300,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx
RSN,300,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx

2. Text2.txt looks like
TDS,100,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx
TDS,200,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx
TDS,300,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx

The output i am looking should look like this,
HDR,100,xxx,xxx,xxx,xxx,xxx,xxx,xxx
DTL,100,xxx,xxx,xxx,xx,xx,xxx,xxx,xxxx,xxx,xx,xxx,
RSN,100,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx
TDS,100,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx
HDR,200,xxx,xxx,xxx,xxx,xxx,xxx,xxx
DTL,200,xxx,xxx,xxx,xx,xx,xxx,xxx,xxxx,xxx,xx,xxx,
RSN,200,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx
RSN,200,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx
RSN,200,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx
TDS,200,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx
HDR,300,xxx,xxx,xxx,xxx,xxx,xxx,xxx
DTL,300,xxx,xxx,xxx,xx,xx,xxx,xxx,xxxx,xxx,xx,xxx,
RSN,300,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx
RSN,300,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx
TDS,300,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx

The RSN(Reason) line is not consisitant for each set, as you can see it can have 3, 2 or 1. I want the TDS line to be inserted last on each set. I would appreciate if anyone can help me on this issue, on how to achieve this using MAPForce.
paul
Posted: Wednesday, December 22, 2010 7:30:28 AM
Rank: Advanced Member

Joined: 9/9/2005
Posts: 483
Location: AT
Hello,

The basic approach would be to use FlexText on at least one of the source files, to permit more flexibility with the logic which inevitably will be needed in order to insert the records from the second text file. I have sent you a solution in response to the support case you also submitted...
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.