Skip to Content
avatar image
Former Member

File content conversion - keyFieldValue with spaces only

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       201505011635 HEAD 0001    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       201505011635 HEAD 0001aaaa03

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jun 10, 2015 at 05:34 AM

    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

    Add comment
    10|10000 characters needed characters exceeded