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 » How to get count of repeating elements using ESQL??

Post new topic  Reply to topic
 How to get count of repeating elements using ESQL?? « View previous topic :: View next topic » 
Author Message
Fuzzy_mq
PostPosted: Fri Oct 15, 2004 3:01 am    Post subject: How to get count of repeating elements using ESQL?? Reply with quote

Apprentice

Joined: 27 May 2004
Posts: 31
Location: US

Hi Folks,

I am having XML as input Message.
e.g
<Customer>
<Name>Ivin</Name>
<OrderNum>2346</OrderNum>
<ItemDetails Item="Chocs" Qty="20">
<ItemDetails Item="Cookies" Qty="15">
<ItemDetails Item="Bud" Qty="5">
</Customer>

Now I want count of ItemDetails in ESQL. How do I get that? I am trying to use cardinality but for some reason its not working.


Regards,
Suchit
Back to top
View user's profile Send private message
aq
PostPosted: Fri Oct 15, 2004 4:59 am    Post subject: Reply with quote

Apprentice

Joined: 20 Dec 2001
Posts: 47

Hi

Is the sample XML in your post exatcly same that you are using ? I think it's not valid XML (end-tag's of ItemDetails elements are missing).

<Customer>
<Name>Ivin</Name>
<OrderNum>2346</OrderNum>
<ItemDetails Item="Chocs" Qty="20"/>
<ItemDetails Item="Cookies" Qty="15"/>
<ItemDetails Item="Bud" Qty="5"/>
</Customer>


But for valid XML you can get the count:
"SET xyz = CARDINALITY(InputBody.Customer.ItemDetails[]);"




Regards,
aq
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Oct 15, 2004 5:16 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

How do you know that CARDINALITY isn't working?

What value is it returning you for what input?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Fuzzy_mq
PostPosted: Fri Oct 15, 2004 7:23 am    Post subject: Reply with quote

Apprentice

Joined: 27 May 2004
Posts: 31
Location: US

Guys hold on for some time, I am testing this and will let u know..
Back to top
View user's profile Send private message
Fuzzy_mq
PostPosted: Fri Oct 15, 2004 9:43 am    Post subject: Reply with quote

Apprentice

Joined: 27 May 2004
Posts: 31
Location: US

Thanks Aq and jeff for the replies.

Aq your solution worked. Yes I am getting valid XML. For the post, I just typed in a sample XML.

Jeff I was goofing up with the syntax a bit. I was using
SET xyz = CARDINALITY(InputBody.Customer.ItemDetails.*[]);

and so I thought cardinality was not working but I was wrong.

Anyway all fine now...

Thanks a lot for your help.

Regards,
Suchit
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 » How to get count of repeating elements using ESQL??
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.