cancel
Showing results for 
Search instead for 
Did you mean: 

Help With File Content Conversion

Former Member
0 Kudos

Hi experts.

I have problems with a file content conversion.

I get the attached file incomingfileorders.txt from an FTP server.

In this file there will be multiple orders and they are to be converted into the XML struucture of the uploaded file TargetOrderXML.xml.

The line starting with F0000 are the startrecord of the file and is to be transferred into the StartRecord segment.

Line will be represented as follow

Fileds: KEY,ID,Date,Time,TransactionCode

Positions: 5,40,8,10,4

The Line starting with H0101 is the orderheader and is to be transferred into the corresponding OrderHeader Segment.

Fields: KEY, OrderType, Company, DistributionChannel, Operational

Positions: 5,4,4,2,2

The Line starting with H0402 is customerdata and is to be transferred into corresponding CustomerData segment.

Fields: KEY,CustomerNumber,Operational,VersionNumber

Positions: 5,10,20,4

The Line starting with H4002 is the invoicefee and is to be transferred into the corresponding segment InvoiceFee.

Fields: KEY,Value

Positions: 5,2

Line starting with R0402 is the lineitems and are to be transferred into the corresponding segment LineItems.

Fields: KEY,Material,Quantity

Positions: 5,18,19

Line starting with R0457 is the profitunit and is to be transferred into the corresponding segment ProfitUnit.

Fields: Key,Value

Positions: 5,10

Lines starting with R0620 is the pricerecords and is to be transferred into corresponding segment PriceRecords.

This line has special rules. If the last 16 digits of the first PriceRecord is 0000000000000,00 then the second PriceRecord line will miss the last 16 digits, conclusion SecondValue will not be populated and I would prefer if the SecondValue field is created as an empty field.

Fields: KEY,PEFirst,FirstValue,PESecond,SecondValue

Positions: 5,4,16,4,16

Lines starting with H0150 is itemtexts and are to be transferred into correcponding segment ItemTexts. I’m not sure if I need the KEY field in the segment or if it could be removed. If the solution is to remove the KEY field then that is totally ok. Each line is to be transferred into a field called Text.

In the example target file I removed the KEY field.

Lines Starting with F9999 is the endrecord of the file and is to be transferred into the corresponding segment EndRecord.

Fields: KEY,Date,Time,NumberOfRecords,NumberOrderHeader,NumberOfItems,OrderValue

Positions: 5,8,10,10,10,10,10

Attached in the post you find the incoming text file named incomingfileorders.txt and you also have an example of the target file created from the txt file. Target file is named TargetOrderXML.xml.

Been trying to get this conversion to work with no luck. Would be appreciated if you experts are able to help me with the conversion.

Best Regards

Andreas

Was an error in the target file. There was an EndRecord to much. Also adding file describing target structure.

Accepted Solutions (1)

Accepted Solutions (1)

former_member184720
Active Contributor
0 Kudos

Hi Andreas - unable to open the TargetStructure.xml seems to be invalid .


Was an error in the target file. There was an EndRecord to much. Also adding file describing target structure.

>>> What is the error? Can you please provide some additional information on this.


second PriceRecord line will miss the last 16 digits, conclusion SecondValue will not be populated and I would prefer if the SecondValue field is created as an empty field.

>>>You can configure the below parameters.


  1. NameA.keepIncompleteFields

This parameter is only evaluated if you enter a value for NameA.fieldFixedLengths.

○       If you enter NO and the last field found in the structure is shorter than specified in NameA.fieldFixedLengths, processing is terminated with a corresponding error message.

This is the default.

○       If you enter YES, the last field found in the inbound structure is transferred to the outbound structure, even if it is shorter than specified in NameA.fieldFixedLengths.


  1. NameA.missingLastfields

If the inbound structure has less fields than specified in the configuration then the XML outbound structure is created as follows:

○       ignore

Outbound structure only contains the fields in the inbound structure

○       add

Outbound structure contains all fields from the configuration; the fields missing in the inbound structure are empty.

○       error

Conversion is terminated due to the incomplete inbound structure. An error message is displayed.



Former Member
0 Kudos

The error is corrected in the uploaded file.

There was to many EndRecords in the file uploaded from the beginning.

//Andreas

Former Member
0 Kudos

Hi.

When i get mutiple lines of the same segment then the content conversion failes.

How will i be able to handle multiple segments of the same type?

In this case it is the LineItems that has 2 entrys.

When the conversion settings starts to read the second entry the conversuion fails.

//Andreas

former_member184720
Active Contributor
0 Kudos

How did you configure the recordset strcture?

Can you share the screenshot? You might have to give LineItems,*

Former Member
0 Kudos

I just had to change the RecordSet Sequence to Variable.

Thanks fot the help in pointing out how to handle lines not matching fixed position.

//Andreas

Answers (2)

Answers (2)

Former Member
0 Kudos

Have a last problem with this content conversion.

In the attached file (resultasis.xml) you see the result if the file contains 2 orders.

I would like to have the result as in the attached file (expectedresult.xml).

How do I get my RecordSet to repeat it self for each OrderHeader?

//Andreas

Former Member
0 Kudos

Is it possible to maken an extra segment between RecordSet and the other segments containing data?

Like this.


TicketSalesOrder

     RecordSet

          NewSegment

               OrderHeader

                    Fields....

               CustomerData

                    Fields...

               .

               .

               .

Hope you understand what I mean.

How do I have to change the content conversion to acomplish this?

//Andreas

ankit_srivastava3
Participant
0 Kudos

Hello Andreas,

Standard FCC at sender side supports 2 level of hierarchy like:

<OrderHeader>

     Fields

</OrderHeader>

<Item>

     Fields

</Item>

.

.

.

<Item>

     Fields

</Item>

<Trailer>

     Fields

</Trailer>

In your case, you want to add one more level of hierarchy. In my opinion, it is not possible through standard FCC.

When you already have FCC ready, then create a java mapping and pass this FCC generated XML to add another level of hierarchy. Refer

Regards,

Ankit

Former Member
0 Kudos

But that example handles , separated values.

I have fixed positions.

Sorry can see now that they first do a FCC and then Java mapping.

Will look into this solution of my problem.

Thanks.

//Andreas

Muniyappan
Active Contributor
0 Kudos

Hi,

I think the below structure is not possible using FCC.

</ItemTexts> 1...unbounded

    </Text>  1...unbounded

you have to make it Text 1..1 in the sender.

in the receiver you can make it 1.unbounded

then achieve this using message mapping

but if you look at the input structure it has one </ItemTexts> per Recordset. why is it having occurrence unbounded?

what condition are you trying to create separate Recordset?

Regards,

Muni.