Link to home
Start Free TrialLog in
Avatar of 007programmer
007programmerFlag for United States of America

asked on

Already returning distinct values, need counts for each respective value as well

If I run this against a ML database:

let $audiences :=
for $doc in xdmp:directory("/myDirectory/")
where fn:contains($doc, 'BLAH')
return $doc/audience

for $audience in distinct-values($audiences)
return $audience

This will return the disctinct values, however I also want the counts for each of these values
ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 007programmer

ASKER

I've requested that this question be deleted for the following reason:

No suitable answers
Hi,
The least you can do is respond to my suggestion,
I definitely gave you code to test and debug
So I have to object closing this
My next suggestion would have been to have the distinct-values() on the text nodes that are descendents of the $audience. Some XQuery processors are tricky about that.
But first of course you could have tried the suggestion and could have given feedback about this.
Note that you sollicited for my time, which I voluntarily gave you, the least I can demand is feedback
My recommendation:
Accept http:#a37993619
The question was "This will return the disctinct values, however I also want the counts for each of these values "
That is exactly (I tested prior to posting) what the code I posted does