cancel
Showing results for 
Search instead for 
Did you mean: 

Trailing Spaces not preserved in Message Transform Bean:XML to Plain

0 Kudos

The outfile generated is like this

E1MARAM                   00000000000000l1f100000000000000l1f5l1f300000l1f4          l1f8000001234.000l1f2l1f                                l3f1                                        l1f9
E1MARCM                   l3f2
Z1EDPAUSPM                                          l2f3    l2f4

There is no extra space getting inserted after each segment if the last field does not come in XML. In the above file, in E1MARAM the fields corresponding to fixed lengths  3 & 18 did not come. Can you please help me in resolving this issue. The requirement is that at the end there  should be trailing spaces as per the fixed length in case if the last field does not come in the XML. I tried adding map with default but still it is not preserving the trailing whitespaces.

Thanks in advance,

Sushobhan

Accepted Solutions (1)

Accepted Solutions (1)

RaghuVamseedhar
Active Contributor
0 Kudos

Sushobhan,

Try this solution

1. In message mapping, for the last field mapWithDefault   "                  ." (there are 18 spaces and then a period).

2. In StrictXml2PlainBean

xml.E1MARAM.fieldLengthExceededcut
0 Kudos

Hi Raghu,

I have used StrictXml2PlainBean,

But in the output,I am getting a new line after each record ,highlighted in Black.I have not used any line feed , still this extra line is getting added, when opening with notepad++ .

0 Kudos

Hi Raghu,

It is working fine now with StrictXml2PlainBean and instead of lineSeparator I used fieldSeparator,which is not adding any extra line. Thanks for your reply

former_member184720
Active Contributor
0 Kudos

Please close the thread as the issue has been resolved.

Answers (2)

Answers (2)

former_member184720
Active Contributor
0 Kudos

I don't think fieldcontentformating is applicable for receiver (xml to plain conversion). So remove that.

And when you test your mapping, do you see spaces in test tab? you can check it in xm view.

0 Kudos

We tried removing that as well. In mapping we can see the trailing spaces but not in the file.

former_member184720
Active Contributor
0 Kudos

If you can see the spaces post mapping, then just fieldFixedLengths should work.

Make sure that there are no additional spaces/typo's in any of the MTB properties. May be recreate the channel


If you still face any issue, follow Greg's suggestion to maintain length's in Data type and see if that helps..

engswee
Active Contributor
0 Kudos

Just to confirm Hareesh's advise. As long as the last fields are there (which you can map with constant or mapWithDefault), the content conversion should populate trailing whitespaces up to the configured fixed length.

In Hareesh's own words "a picture is worth a thousand words" , here are three thousand words for you.

Here's the MTB config

Input XML file having additional whitespaces on the last fields of each segment type

Output flat file has the trailing white space. Note that even for Delivery1, even if there is no additional whitespace in the XML, it still populates up to the configured length.

By the way, there are a lot of extraneous parameters in your setting that you don't really need. You can safely remove endSeparator, fieldContentFormatting, absoluteRowWidth. For further details of what parameter is available for each conversion type, you can check out the document below.

Rgds

Eng Swee

0 Kudos

Hi Eng,

My requirement was not that.Actually spaces were coming when values were there. However it is working now using Adding StrictXml2PlainBean (XML to Text) in the Module Processor - Adding Modules to the Module Proc...

former_member184720
Active Contributor
0 Kudos

You are awesome

Harish
Active Contributor
0 Kudos

Hi sushobhan,

Please refer the below thread

regards,

Harish

0 Kudos

hi,

I tried the parameters in these links but it did not help. The parameter fieldFormatting seems to be for sender channel only.