cancel
Showing results for 
Search instead for 
Did you mean: 

PI Mapping Add trailer space

Former Member
0 Kudos

Hello,

I had to add a trailer space to one of the field at the end to be sent out as an EDI.(Seeburger).

For example the value is "7" i need to send it as "7_"  where the underscore should be just a space.

How do I do that in XI, when I add it through the map i do see in the test run but do not see it in the actual EDI file generated.Some where it's getting lost, I know that it's an XML property but is there a way it could be added and send in this way?

PI 7.0 SP15

Let me know your thoughts.

Thanks in advance!

Larry.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

If you want to have a field, which is filled with spaces from right side just do the following:

1. Concatenate our field with constant like "                                    ]"

2. Substring the result to legnth required

That's all Folks!

former_member184681
Active Contributor
0 Kudos

Hi Larry,

I agree with the previous speakers that such behaviour is a characteristic of the XML standard. Whenever I have such doubts, I always refer to the XML specification by W3C. Here is what is says about the extra spaces and white space handling in general:

http://www.w3.org/TR/REC-xml/#sec-white-space

Here are the two possiblities that I would try out:

1. If you received the format specification from the receiver system (such as an .xsd file), you can add the xml:space preserve attribute to this schema manually and reimport it to PI (or ask the receiver to do it for you).

2. Another option (if you defined the receiver structure manually in PI) is to set the minLength of the XML node discussed. This could also help preserving the extra spaces.

Regards,

Greg

Former Member
0 Kudos

Hi Greg,

  I have a similar kind of requirment where the whitespace are getting trimmed when it get processed in PI.

currently xml is from MQ (JMS) -- > PI -- ECC, where in a segmnet has the field as below

<FIELD2>0299                   N         23487   02  00N                                    0.00 </FIELD2>

and the output is

<FIELD2>0299 N 23487 02 00N 0.00 </FIELD2>

but I need to maintain the same format till it reaches ECC , as there is a validationg based on this format.

can I have your input.

rajasekhar_reddy14
Active Contributor
0 Kudos

you dont need any UDF use CONSTANT function with space and conact to your input.

Former Member
0 Kudos

Raja, I tried it first, think it's an XML limitation, I could see the space added in test(debug) but it does not show up in EDI when it got created.

rajasekhar_reddy14
Active Contributor
0 Kudos

yeah , true.

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Since you use pi 7.0 which supports only jdk 1.4 you cannot use String's method format in your case.

Please use this link for creating udf to pad empty space in the string.

http://www.java2s.com/Code/Java/Data-Type/RightpadaStringwithaspecifiedString.htm

Former Member
0 Kudos

Is there a simplified version of this UDF?

I tried to simplify it for the test, it added the space at the end but it didn't show up in the EDI document..again i could see it in test source but not in moni or in the EDI file

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Leading and trailing spaces might be removed by the edi logic at run time. Somewhere the string method trim might have been used to remove the empty trailing spaces. If that's so, you might talk to the target system to send some characters at the end instead of empty space. You can use the same constant or the above udf logic for the same.