cancel
Showing results for 
Search instead for 
Did you mean: 

File content conversion - keyFieldValue with spaces only

Former Member
0 Kudos

Hello

I´m configuring MessageTransformBean module to convert a text flat file to XML file.

My flat file has fixed lengths and I´m using keyFieldValue to get the correct structure. The problem is that the header structure has '    ' (4 spaces) value at the keyFieldValue and I´m unable to make it work.

To clarify, this is the header line:

920       201505011635HEAD0001    03

                                                                        ^   4 spaces key field value

I already tried it many ways:

xml.Header.keyFieldValue:     (4 spaces)

xml.Header.keyFieldValue:'0x20''0x20''0x20''0x20'

I also have xml.fieldContentFormatting = nothing

If I change the source text file to:

920       201505011635HEAD0001aaaa03

and configure the module as:

xml.Header.keyFieldValue:aaaa

It works perfectly. So my configuration of fields and everything else is correct, the only problem are the spaces. I made some tests trying to use hex code for aaaa testing like '0x61''0x61''0x61''0x61' but hex code doesn´t work anyway. Woking on PI 7.11.

Any ideia?

Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

engswee
Active Contributor
0 Kudos

Hi Vitor

The source code for MessageTransformBean will trim the value specified in the position for the key field. As such, white spaces are not allowed as part of a key field value - it does not matter whether you use spaces or hexadecimal.

Is there any other field position in the header line that can be used to uniquely identify the header line? Note that the position for the key field does not need to be at the same position for each structure type. Noticed that part of the header line has the value "HEAD", perhaps you can use this position instead as the key field.

Rgds

Eng Swee

Former Member
0 Kudos

Hello Eng Swee Yeoh

I tried that - using the HEAD value, by configuring my key field name in other position. But doesn´t work.

This module has weird behaviour:

My xml.recordsetStructure = Header,1,MasterShipment,*

I´m testing a file with 1 header and 2 MasterShipment.

My MasterShipment works correctly, not the Header.

If I configure as

xml.recordsetStructure = Header,1,MasterShipment,2

The header works (on original key blank value and also on HEAD value).

The correct in my case should be *.

Any ideia?

Thanks

engswee
Active Contributor
0 Kudos

Hi Vitor

Can you share a screenshot of your whole module configuration? Can you also share the complete test file you are trying out (with 1 header and 2 mastershipment)?

Rgds

Eng Swee