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 » fn:count in mapping node not working as expected

Post new topic  Reply to topic
 fn:count in mapping node not working as expected « View previous topic :: View next topic » 
Author Message
cwazpitt3
PostPosted: Fri Feb 03, 2012 7:54 am    Post subject: fn:count in mapping node not working as expected Reply with quote

Acolyte

Joined: 31 Aug 2011
Posts: 61

This seems like a really simple task, but it is not working as I expect it to.

I have an XML string like below and I am trying to capture the number of occurrences of a repeating element into a field of the target message set.

Code:

<RequestMessage>
   <payload>
      <groups>
         <num>11111111</num>
         <num>22222222</num>
         <num>33333333</num>
         <num>44444444</num>
         <num>55555555</num>
      </groups>
      <otherField>someValue</otherField>
   </payload>
</RequestMessage>


Now I would like to count the number of times the <num> element shows, so I figured I could use the fn:count function like so:

Code:
fn:count($source/RequestMessage/payload/groups/num)


But this returns 1 when I would expect it to return 5. Now I have found several workarounds like a custom ESQL function and putting a for around the element and using msgmap:occurrence, but it doesn't seem like this should be a difficult task. Am I missing something obvious?

Thanks in advance for your help!
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Feb 03, 2012 8:18 pm    Post subject: Reply with quote

Grand High Poobah

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

Have you looked at the cardinality function?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
cwazpitt3
PostPosted: Mon Feb 06, 2012 4:28 am    Post subject: Reply with quote

Acolyte

Joined: 31 Aug 2011
Posts: 61

fjb_saper wrote:
Have you looked at the cardinality function?


This would be an ESQL function only unless I am missing something. As I said, I have several workarounds, CARDINALITY being one of them, but I was wondering why the built in function did not seem to be working as designed.
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 » fn:count in mapping node not working as expected
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.