|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
fn:count in mapping node not working as expected |
« View previous topic :: View next topic » |
Author |
Message
|
cwazpitt3 |
Posted: Fri Feb 03, 2012 7:54 am Post subject: fn:count in mapping node not working as expected |
|
|
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 |
|
 |
fjb_saper |
Posted: Fri Feb 03, 2012 8:18 pm Post subject: |
|
|
 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 |
|
 |
cwazpitt3 |
Posted: Mon Feb 06, 2012 4:28 am Post subject: |
|
|
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 |
|
 |
|
|
 |
|
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
|
|
|
|