ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to support empty value in xml field using esql

Post new topic  Reply to topic
 How to support empty value in xml field using esql « View previous topic :: View next topic » 
Author Message
chaitu
PostPosted: Mon May 16, 2016 1:12 am    Post subject: How to support empty value in xml field using esql Reply with quote

Voyager

Joined: 15 Apr 2014
Posts: 89

Hi All,

I am trying to build a xml tree using esql like

Code:

 SET ADR1 = '0';
 SET ADR2 = '0';
 SET ADR3 = '"P"';
 SET ADR4 = CAST(InputRoot.DFDL.ECI_DEMO_ADR_LINE_1 AS
CHARACTER);
 CREATE LASTCHILD OF OutputRoot DOMAIN('XMLNSC');
 SET OutputRoot.XMLNSC.Data =(ADR1 || ',' || ADR2 || ',' ||ADR3 ||','||ADR4);


If I get a value on ADR4 I am able to create the outputroot
but if ADR4 is empty then iam not able to create the output tree.

can anyone give any suggestions on this.
Thanks in Advance.
Back to top
View user's profile Send private message
maurito
PostPosted: Mon May 16, 2016 1:22 am    Post subject: Re: How to support empty value in xml field using esql Reply with quote

Partisan

Joined: 17 Apr 2014
Posts: 358

chaitu wrote:
Hi All,

I am trying to build a xml tree using esql like

Code:

 SET ADR1 = '0';
 SET ADR2 = '0';
 SET ADR3 = '"P"';
 SET ADR4 = CAST(InputRoot.DFDL.ECI_DEMO_ADR_LINE_1 AS
CHARACTER);
 CREATE LASTCHILD OF OutputRoot DOMAIN('XMLNSC');
 SET OutputRoot.XMLNSC.Data =(ADR1 || ',' || ADR2 || ',' ||ADR3 ||','||ADR4);


If I get a value on ADR4 I am able to create the outputroot
but if ADR4 is empty then iam not able to create the output tree.

can anyone give any suggestions on this.
Thanks in Advance.

Look at the available ESQL string manipulation functions . There is one that will help you with that.

Correction: Miscellaneous ESQL functions.
Back to top
View user's profile Send private message
chaitu
PostPosted: Mon May 16, 2016 6:02 am    Post subject: Reply with quote

Voyager

Joined: 15 Apr 2014
Posts: 89

Hi maurito,

Thanks for the reply.
I used COALESCE function and now I am passing Null in place of empty field.
Code:

SET ADR4 =  COALESCE(CAST(InputRoot.DFDL.ECI_DEMO_ADR_LINE_1 AS CHARACTER),'NULL');
 
Back to top
View user's profile Send private message
mayheminMQ
PostPosted: Wed May 18, 2016 6:14 am    Post subject: Reply with quote

Voyager

Joined: 04 Sep 2012
Posts: 77
Location: UK beyond the meadows of RocknRoll

The result of a concatenate using || will give out a NULL even if one value was NULL so I am not sure how did you solve this by using COALESCE?
_________________
A Colorblind man may appear disadvantaged but he always sees more than just colors...
Back to top
View user's profile Send private message
smdavies99
PostPosted: Wed May 18, 2016 6:25 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

ADR1, ADR2 & ADR3 are set to explicit not derived values so they can never give a null result when concatenating them.

ADR4 is set using a concatenate that specified the string 'NULL' if the first part results in a real null value.

so

OutputRoot.XMLNSC.Data = '00PNULL'

OR

OutputRoot.XMLNSC.Data = '00P' || The real value of 'InputRoot.DFDL.ECI_DEMO_ADR_LINE_1' cast to a CHAR;
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to support empty value in xml field using esql
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.