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 » problem to get values from select statement

Post new topic  Reply to topic
 problem to get values from select statement « View previous topic :: View next topic » 
Author Message
know_ashu
PostPosted: Mon Sep 12, 2005 4:06 am    Post subject: problem to get values from select statement Reply with quote

Novice

Joined: 25 Jun 2005
Posts: 22

Hi,
I am using a select statement that I cannot change, problem description is as below:
I have an XML message coming in a compute node like:

<Test><Comment>this is a comment</Comment></Test>

And want output xml after a select statement as below:

<Test>
<Comment>this is a comment</Comment>
<note>this is the first row</note>
<note>this is the second row</note>
<note>this is the third row</note>
<note>this is the fourth row</note>
</Test>
To achieve the expected output I am doing select as:

SET OutputRoot.XML.Test.note[] = PASSTHRU('SELECT distinct T.Column1 as note, T.Column2 FROM Database.USERTABLE AS T order by Column1, Column2');

My questions :
1. I do not want Column2 in my XML and cannot change the query also. How to get rid of Column2 in the output XML?
2. Is it the right approach I am using to achieve the results?
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Sep 12, 2005 6:08 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You can assign the results of the Select to the Environment tree, and then either manually copy all elements that are "note" elements, or use another Select to only get the note elements.

Or you can add another compute node, and then go through and only copy the note elements instead of both the note and the order elements.

Or you can write a loop that will go through the output and delete the order elements.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
know_ashu
PostPosted: Wed Sep 14, 2005 12:40 am    Post subject: Reply with quote

Novice

Joined: 25 Jun 2005
Posts: 22

thanks for your response. I implemented it using environment variables.
Back to top
View user's profile Send private message
ghada
PostPosted: Mon Oct 24, 2005 12:16 am    Post subject: Reply with quote

Apprentice

Joined: 13 Oct 2005
Posts: 41
Location: Egypt

hi
you may use
SET OutputRoot.XML.Test.note[] = PASSTHRU('SELECT distinct ITEM T.Column1 as note, T.Column2 FROM Database.USERTABLE AS T order by Column1, Column2');

it will return only the field value without field name
i hope it helps
Back to top
View user's profile Send private message Yahoo Messenger
elvis_gn
PostPosted: Mon Oct 24, 2005 1:28 am    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi ghada,
guess you failed to notice

Quote:

1. I do not want Column2 in my XML and cannot change the query also


I feel jefflowrey has settled this one in his post....

Regards.
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 » problem to get values from select statement
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.