Search code examples
wso2wso2-data-services-server

How to aggregate results to list in wso2dss


Assumig i call service in wso2dss that executed a query which return next result:

PERSON_ID | DOCUMENT_ID
    1            10
    1            11
    2            12
    2            13

I want to pack documents for every person to list and then retunt it in next format about.

<results>
    <person>
        <id>1</id>
        <documents>
            <document>10</document>
            <document>11</document>
        </documents>
    </person>

    <person>
        <id>2</id>
        <documents>
            <document>12</document>
            <document>13</document>
        </documents>
    </person>
</results>

How can i group documents?


Solution

  • You can use XSLT transformation on the query to get the result formatted. A sample can be found from here.

    Thanks