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 » Select stement in XML (Attributes in Where Clause)

Post new topic  Reply to topic
 Select stement in XML (Attributes in Where Clause) « View previous topic :: View next topic » 
Author Message
Ramphart
PostPosted: Mon Feb 11, 2013 4:46 pm    Post subject: Select stement in XML (Attributes in Where Clause) Reply with quote

Disciple

Joined: 21 Jul 2004
Posts: 150
Location: South Africa, JHB

WebSphere Broker v7.0.0.5,
Windows Server 2008 R2 Standard

I need to use a Select statement to return the element field value based on it's attribute value:

Quote:

<shipTo>
<tag TypeCode="CODE">abc</tag>
<tag TypeCode="PLANT">def</tag>
<tag TypeCode="YEAR">2013</tag>
</shipTo>

Code:

SET OutputRoot.MRM.LineItems[cntLine].Plant = THE (SELECT FIELDVALUE(InputRoot.XMLNSC.shipTo.tag)
   FROM InputRoot.XMLNSC.InputRoot.XMLNSC.shipTo.tag[]
   WHERE FIELDVALUE(InputRoot.XMLNSC.InputRoot.XMLNSC.shipTo.tag.(XMLNSC.Attribute)TypeCode) = 'PLANT');


The expected result is that value "def" is returned. However, the code above return NULL. It works if I search for the first TypeCode="CODE" in the <tag> array though and returns "abc"

Can someone help me with the proper syntax to search for a tag field value further down in the <tag> array when interrogating the tree based on the corresponding TypeCode attribute?

Thanks in advance for your response
_________________
Applications Architect
Back to top
View user's profile Send private message
kash3338
PostPosted: Mon Feb 11, 2013 10:01 pm    Post subject: Reply with quote

Shaman

Joined: 08 Feb 2009
Posts: 709
Location: Chennai, India

This code should work,

Code:

SET OutputRoot.XMLNSC.LineItems.Plant = THE (SELECT ITEM FIELDVALUE(T) FROM InputRoot.XMLNSC.shipTo.tag[] AS T WHERE FIELDVALUE(T.(XMLNSC.Attribute)TypeCode) = 'PLANT');
Back to top
View user's profile Send private message Send e-mail
Ramphart
PostPosted: Mon Feb 11, 2013 11:31 pm    Post subject: Reply with quote

Disciple

Joined: 21 Jul 2004
Posts: 150
Location: South Africa, JHB

Hi kash

It works like a charm. Thx a mil.
_________________
Applications Architect
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Feb 12, 2013 4:27 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Ramphart wrote:
Hi kash

It works like a charm. Thx a mil.


You always have to use AS and a qualifier in ESQL Select, so you always have to say something like 'AS T' and then use 'T.' to reference the selected fields.
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 » Select stement in XML (Attributes in Where Clause)
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.