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 map a xml file to text file if the file having multiple batches information Options · View
rmuralirama
Posted: Tuesday, February 10, 2015 1:31:03 PM
Rank: Guest

Joined: 12/13/2005
Posts: 0
Hi,

I would like to map xml file to a text file. Please find the attached files

CompanyInfo.xml - Input xml files

CompanyOutput.txt - Output text file.

Input file will be in the following structure

a)Each File Contains one FileHeader and File Control Record
b) Each File Contains Multiple Batches.
c) Each Batch Contains Multiple EntryDetails

Expected Output file should be in the following Manner.
FileHeaderInformation
FirstBatchHeaderInformation
EntryDetailInfomationLine1
EntryDetailInfomationLine2
EntryDetailInfomationLine3
FirstBatchControlInformation
SecondBatchHeaderInformation
EntryDetailInfomationLine1
EntryDetailInfomationLine2
SecondBatchControlInformation
FileControlInfomation

i have created Flex Text by using Altova Mapforce Flex Text in delimited floating based mode.
After executipon, Im getting the output in this manner.

FileHeaderInformation
FirstBatchHeaderInformation
SecondBatchHeaderInformation
EntryDetailInfomationLine1
EntryDetailInfomationLine2
EntryDetailInfomationLine3
EntryDetailInfomationLine1
EntryDetailInfomationLine2
FirstBatchControlInformation
SecondBatchControlInformation
FileControlInfomation

Could you please help me to get the expected output

2) Each and Every batch contains 10 EntryDetailInformation. if the block doesnt have 10 records, then need to append value "99999" to the file.

Let me take an example if the file having 2 batches with 15 records, then i need to add 5 lines of value "99999" to the file.
i.e. batchcount*10 = no of lines in a file.
i.e. 2*10 = 20 (lines in a file).

Could u please help me how to append a value dynamically no of lines to the file.


Thanks in Advance.


File Attachment(s):
CompanyInfo.xml (2kb) downloaded 1,097 time(s).
CompanyInfo.txt (1kb) downloaded 1,108 time(s).


pfisher44
Posted: Tuesday, February 10, 2015 3:02:11 PM
Rank: Advanced Member

Joined: 8/29/2012
Posts: 146
Location: atlanta
You may be able to add an entry to the end of your target to hold the value and use the node count function. i've never tried it however.
that may be the only way as mapforce is somewhat stateless, no "real" variables to iterate over and increment.

rmuralirama wrote:
Hi,

I would like to map xml file to a text file. Please find the attached files

CompanyInfo.xml - Input xml files

CompanyOutput.txt - Output text file.

Input file will be in the following structure

a)Each File Contains one FileHeader and File Control Record
b) Each File Contains Multiple Batches.
c) Each Batch Contains Multiple EntryDetails

Expected Output file should be in the following Manner.
FileHeaderInformation
FirstBatchHeaderInformation
EntryDetailInfomationLine1
EntryDetailInfomationLine2
EntryDetailInfomationLine3
FirstBatchControlInformation
SecondBatchHeaderInformation
EntryDetailInfomationLine1
EntryDetailInfomationLine2
SecondBatchControlInformation
FileControlInfomation

i have created Flex Text by using Altova Mapforce Flex Text in delimited floating based mode.
After executipon, Im getting the output in this manner.

FileHeaderInformation
FirstBatchHeaderInformation
SecondBatchHeaderInformation
EntryDetailInfomationLine1
EntryDetailInfomationLine2
EntryDetailInfomationLine3
EntryDetailInfomationLine1
EntryDetailInfomationLine2
FirstBatchControlInformation
SecondBatchControlInformation
FileControlInfomation

Could you please help me to get the expected output

2) Each and Every batch contains 10 EntryDetailInformation. if the block doesnt have 10 records, then need to append value "99999" to the file.

Let me take an example if the file having 2 batches with 15 records, then i need to add 5 lines of value "99999" to the file.
i.e. batchcount*10 = no of lines in a file.
i.e. 2*10 = 20 (lines in a file).

Could u please help me how to append a value dynamically no of lines to the file.


Thanks in Advance.


island
Posted: Tuesday, February 10, 2015 7:01:42 PM
Rank: Newbie

Joined: 10/28/2002
Posts: 1,283
Location: AT
Hi,

for part 1) see attached mapping and flextext.

File Attachment(s):
test.zip (4kb) downloaded 1,039 time(s).


rmuralirama
Posted: Wednesday, February 11, 2015 6:50:58 AM
Rank: Guest

Joined: 12/13/2005
Posts: 0
Thanks pfisher44 and island

I got the above first part as on your guidlines.


Thank you once again.


Could you please help me on the second part of the above question

i.e. How to map a constant value to the end of a file multiple times based on the no of count(This count will tell to the no of lines added in the file).


Thanks in Advance.
chandraN
Posted: Thursday, February 12, 2015 11:56:18 AM
Rank: Newbie

Joined: 2/11/2015
Posts: 2
Location: India
Hi island,

im also need the same requirement as mentioned above.

Please see the attached files.

My xml file contains extra block with along data

<Blocked>
<DefaultBlock>99999</DefaultBlock>
<DefaultBlock>99999</DefaultBlock>
<DefaultBlock>99999</DefaultBlock>
<DefaultBlock>99999</DefaultBlock>
</Blocked>

This block contains multple default block entries
These should be append last to the file

My expected output should be like this.


FileHeaderInformation
FirstBatchHeaderInformation
SecondBatchHeaderInformation
EntryDetailInfomationLine1
EntryDetailInfomationLine2
EntryDetailInfomationLine3
EntryDetailInfomationLine1
EntryDetailInfomationLine2
FirstBatchControlInformation
SecondBatchControlInformation
FileControlInfomation
DefaultBlockInfomation1
DefaultBlockInfomation2
DefaultBlockInfomation3
DefaultBlockInfomation4

Could you please help me to get the expected output.

Thanks in Advance.

File Attachment(s):
CompanyInfo.xml (3kb) downloaded 1,057 time(s).
CompanyInfo.txt (1kb) downloaded 1,038 time(s).


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.