|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
NULL handling in ESQL |
« View previous topic :: View next topic » |
Author |
Message
|
llaros |
Posted: Tue Jan 22, 2008 10:21 am Post subject: |
|
|
Apprentice
Joined: 22 Jan 2008 Posts: 37
|
Hi everybody
I also have a problem with TDS parser & null handling.
My Data Element Separation is AllElementsDelimited.
I try to develop a flow which gets a message in XMLNSC format and writes output as a TDS1.
I want this flow to write abscent elements of my model as a null (null will be represented as '^' characeter in a bitstream) to the output TDS stream, and that this elements values will be distinctive from empty strings.
Now when I put a message like this:
<?xml version="1.0" encoding="ASCII"?>
<getCustomerAddress>
<customer>
<firstName>Jakub</firstName>
</customer>
<address>
<street>4th Avenue</street>
</address>
</getCustomerAddress>
The flow is writing this bitstream to the output:
{{Jakub;};{,,,,,,,,,;;;4th Avenue}}
where
; is a delimiter
, is a repeating separator
{ is a begining of a complex type indicator
} is a end of a complex type indicator
But I'd like the parser to produce:
{{Jakub;^};{^,^,^,^,^,^,^,^,^,^;^;^;4th Avenue}}
Is it possible?
I checked Nillable (logical) and (TDS1 Physical) NullLiteralValue '^' everywhere in the Editor.
Please tell me If I should create new topic for this.
I saw CVS examples already but there is no topic on null-handling. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jan 23, 2008 3:04 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
We would prefer it if you started a new thread and referenced this one, rather than appending to an old thread.
Your TDS null settings look correct. I think the problem is in the message tree. The XMLNSC parser will not create NULLs in the message tree, so it contains elements with a value of empty string. That is different from a NULL.
You need to replace the empty strings with an explicit null. The ESQL will look something like this ( not tested ):
Code: |
IF FIELDVALUE(InputRoot.XMLNSC.rootTag.myField) = '' THEN
SET OutputRoot.MRM.myField VALUE = NULL;
END IF; |
I expect there are a couple of syntax errors in there, but you get the idea. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jan 23, 2008 3:35 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Thread split for neatness and clarity _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
llaros |
Posted: Tue Jan 29, 2008 2:58 am Post subject: |
|
|
Apprentice
Joined: 22 Jan 2008 Posts: 37
|
Thanks for your advice. I managed to do that. During testing I noticed that empty strings in elements are treated as null
<elem1><value></value></elem1> is being parsed to:
{^};
and the absent xml elements are parsed to:
{};
(for me it is not intuitive but the most important fact is that it is distinct so the relation [XML->TDS->XML] is transitive. |
|
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
|
|
|
|