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 » Pls Help me out!!!

Post new topic  Reply to topic
 Pls Help me out!!! « View previous topic :: View next topic » 
Author Message
MQTORTOISE
PostPosted: Thu Jan 16, 2003 11:57 am    Post subject: Pls Help me out!!! Reply with quote

Novice

Joined: 24 Dec 2002
Posts: 15

Hi ,Pls can any body suggest me the code for following input..

<Table>
<element1>Hi</element1>
<element2>Hello</element2>
</Table>

I do get elements in a Table ,i may get 2 or 1 elements.So depending on the input element i need to generate the output.I wrote code for element1 is null then do something orelse do something,but i cant generate correct output.
My output should be like
<select>Hi,Hello</select>if both elements exist in input
or else
<select>Hi</select>if element1 exist in input
Thanks in Adv,
MQTortoise..
Back to top
View user's profile Send private message
fschofer
PostPosted: Fri Jan 17, 2003 12:26 am    Post subject: Reply with quote

Knight

Joined: 02 Jul 2001
Posts: 524
Location: Mainz, Germany

Hello MQTORTOISE,

here is my untested solution for your problem and i do not know if it's
the best one. But i think it will work.

DECLARE second_string CHAR;

SET second_string = ',' || COALESCE(InputRoot.XML.Table.element2, '');

IF ( LENGTH(second_string > 1) ) THEN
SET OutputRoot.XML.select = InputRoot.XML.Table.element1 || second_string;
ELSE
SET OutputRoot.XML.select = InputRoot.XML.Table.element1
END IF;


If you do not know the names of your elements or
element 2 can be the only one in your input you can use

*[1] instead of element1 and *[2] instead of element1
Back to top
View user's profile Send private message Send e-mail
MQTORTOISE
PostPosted: Fri Jan 17, 2003 6:16 am    Post subject: Reply with quote

Novice

Joined: 24 Dec 2002
Posts: 15

Thanks Schofer,I have used COALESCE function ,it seems the function is not working in my code.Anyhow thanks for your code...
Thanks again,
MQTortoise...
Back to top
View user's profile Send private message
yaakovd
PostPosted: Mon Jan 20, 2003 9:53 am    Post subject: Reply with quote

Partisan

Joined: 20 Jan 2003
Posts: 319
Location: Israel

Hi
You must check if both of elements are exist in input, otherwise concatenation will faled.

IF(InputRoot.XML.Table.element1 IS NULL OR InputRoot.XML.Table.element1 IS NULL)THEN
SET OutputRoot.XML.select = COALESCE (InputRoot.XML.Table.element1 , InputRoot.XML.Table.element2);
ELSE
SET OutputRoot.XML.select = InputRoot.XML.Table.element1 || ',' || InputRoot.XML.Table.element2;
END IF;

If COALESCE function is not working (it is unbelievable) use following:

IF(InputRoot.XML.Table.element1 IS NULL)
SET OutputRoot.XML.select = InputRoot.XML.Table.element2;
ELSE IF( InputRoot.XML.Table.element2 IS NULL)THEN
SET OutputRoot.XML.select = InputRoot.XML.Table.element1;
ELSE
SET OutputRoot.XML.select = InputRoot.XML.Table.element1 || ',' || InputRoot.XML.Table.element2;
END IF;
END IF;
_________________
Best regards.
Yaakov
SWG, IBM Commerce, Israel
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Pls Help me out!!!
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.