|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
V5 NULLIF treatment of spaces |
« View previous topic :: View next topic » |
Author |
Message
|
whytec |
Posted: Tue Mar 14, 2006 4:10 pm Post subject: V5 NULLIF treatment of spaces |
|
|
 Apprentice
Joined: 28 Nov 2005 Posts: 26 Location: Brisbane Australia
|
I've been doing some testing with WMB5 with the following statement:
Quote: |
SET OutputRoot.XML.TestOutput.Output1 = COALESCE(NULLIF(InputBody.TestInput.Input1, ''), NULLIF(InputBody.TestInput.Input2, ''), 'AllNull'); |
Both of the NULLIF statements are testing the associated tag against an empty string.
One of the tests involves the following input XML (each tag contains one space character):
Quote: |
<TestInput>
<Input1> </Input1>
<Input2> </Input2>
</TestInput> |
The output I am getting is:
Quote: |
<TestOutput>
<Output1>AllNull</Output1>
</TestOutput> |
Am I correct in assuming that the NULLIF statement is doing an implicit TRIM on the contents of the first argument? In the past I've always used a TRIM statement in my code when I wanted to check if there were actual characters other than spaces in a tag, but now it seems that it was an unecessary step.
Example:
Quote: |
SET someoutputtag = COALESCE(NULLIF(TRIM(someinputtag), ''), 'somedefaultvalue'); |
Anyone else found this? Does anyone know whether this also the case with WMQI2.1? I will do some extra testing with tags containing values with leading and trailing spaces and also tags containing two or more spaces. |
|
Back to top |
|
 |
vk |
Posted: Tue Mar 14, 2006 7:40 pm Post subject: |
|
|
Partisan
Joined: 20 Sep 2005 Posts: 302 Location: Houston
|
XML elements having spaces alone without any other values will be trimmed automatically in WMQI 2.1 also.
For TDS message sets, trimming os spaces is based on the property Trim Fix Length String at the message set level. If the property is set to Trim Both, leading and training spaces will be removed.
Regards,
VK. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|