Skip to main content
100%

Grouping example

✓ Published0🌍 Public
CCliffordAnderson
Last edited Oct 2, 2015
Created on Oct 2, 2015

This example shows how XQuery groups report records by author and clearance status, revealing the distribution of cleared, not acquired, and unknown items per author. It first defines a function that maps numeric clearance flags to categorical labels, then queries the `ReportMaster` collection. Using the `group by` clause, it aggregates records by both author and status, while `fn:replace` extracts the author’s surname for ordering. The output is a series of `<report>` elements containing the author and status. The code relies on the XQuery 3.1 standard, specifically the `collection` function and `group by` syntax, with no external visualization libraries.

AI-generated description

Similar vizzes