|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
problem to get values from select statement |
« View previous topic :: View next topic » |
Author |
Message
|
know_ashu |
Posted: Mon Sep 12, 2005 4:06 am Post subject: problem to get values from select statement |
|
|
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 |
|
 |
jefflowrey |
Posted: Mon Sep 12, 2005 6:08 am Post subject: |
|
|
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 |
|
 |
know_ashu |
Posted: Wed Sep 14, 2005 12:40 am Post subject: |
|
|
Novice
Joined: 25 Jun 2005 Posts: 22
|
thanks for your response. I implemented it using environment variables. |
|
Back to top |
|
 |
ghada |
Posted: Mon Oct 24, 2005 12:16 am Post subject: |
|
|
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 |
|
 |
elvis_gn |
Posted: Mon Oct 24, 2005 1:28 am Post subject: |
|
|
 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 |
|
 |
|
|
 |
|
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
|
|
|
|