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 » Accessing XML fields

Post new topic  Reply to topic
 Accessing XML fields « View previous topic :: View next topic » 
Author Message
tanishka
PostPosted: Tue Sep 07, 2010 6:42 pm    Post subject: Accessing XML fields Reply with quote

Centurion

Joined: 24 Nov 2008
Posts: 144

Hi,

MQ input node in my flow receives below Msginfo message. All elements are unbounded.

I need to store length and weight values in environment varibles based on below conditions are met.

Supplier = 333
ind = yes
obj = PACK

<MsgInfo>
<Attributes>
<Msgship>
<Supplier>222</Supplier>
<Ctry>
<id>String</id>
<ind>no</ind>
<Dim>
<obj>CASE</obj>
<length>11</length>
<width>22</width>
</Dim>
</Ctry>
</Msgship>
<Msgship>
<Supplier>333</Supplier>
<Ctry>
<id>String</id>
<ind>yes</ind>
<Dim>
<obj>PACK</obj>
<length>22</length>
<width>33</width>
</Dim>
</Ctry>
</Msgship>
</Attributes>
</MsgInfo>

IF InputRoot.XMLNSC.Msginfo.Attributes.Msgship[].supplier = '333' THEN
IF InputRoot.XMLNSC.Msginfo.Attributes.Msgship[].Ctry[].ind = 'yes' THEN
IF InputRoot.XMLNSC.Msginfo.Attributes.Msgship[].Ctry[].dim[].obj = 'PACK' THEN
SET Environment.Varible.ItemInfo[].Height = ----
SET Environment.Varible.ItemInfo[].weight = ----
END IF;
END IF;
END IF;

Please correct with correct code to access particular element among unbounded.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Sep 07, 2010 7:05 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Use a reference to traverse the array
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
MrSmith
PostPosted: Wed Sep 08, 2010 4:04 am    Post subject: Reply with quote

Master

Joined: 20 Mar 2008
Posts: 215

If you dont where in the repeating group the "structure" you are looking for is then use a FOR loop something like


FOR loopref AS InputRoot.XMLNSC.Msginfo.Attributes.Msgship[] DO

If loopref.supplier = '333' AND loopref.ind = 'yes' AND loopref.Ctry.dim.obj = 'PACK' THEN

SOME OTHER ENVIRONMENT SETTING CODE.....

END IF
END FOR

From your message exampkle there is no need for the array [] situation for some of these elements as thre is only one occurence in that Msgship structure

Alternatively use a slect statement if you want to filter something like

SET Environment.Variables.save = (SELECT A.length FROM inputroot.......Msgship[] AS A where A.supplier = '333' and A.Ctry.ind = 'yes' and A.Ctry.dim.obj = 'PACK'

You can then check your saved variable in Environment to see that you got any results.

There are many ways to do this suggest look at some of the example supplied with the toolkit or scour the forum for FOR loops or whatever code snippets, whilst reading the manual to understand what it is doing

Good luck
Back to top
View user's profile Send private message
tanishka
PostPosted: Wed Sep 08, 2010 9:18 pm    Post subject: Reply with quote

Centurion

Joined: 24 Nov 2008
Posts: 144

Using For loop my problem resolved. Thanks so much for your help.
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 » Accessing XML fields
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.