Author Topic: Document Fragment with custom query and a result set (multiple Dataset_ / rows)  (Read 523 times)

Daiim

  • EA User
  • **
  • Posts: 51
  • Karma: +0/-0
    • View Profile

I try to generate a table of neighbors for a given element via document generation, but only get one entry as a result.
The document template is called for each element and uses a Custom Query (more precise a Custom Script) being called with the #OBJECTID# as parameter.
The script iterates over all neighbors via API and returns a XML for a list of entities, e.g. { Application : "Sparx EA", Vendor: "SparxSystems", Homepage: "https://sparxsystems.com" }.

The XML structure is:
Code: [Select]
<?xml version="1.0" encoding="UTF-8"?>
<EADATA>
    <Dataset_0>
        <Data>
            <Row>
                <Application>Sparx EA</Application>
                <Vendor>SparxSystems</Vendor>
                <Homepage>http://sparxsystems.com</Homepage>
            </Row>
        </Data>
    </Dataset_0>
    <Dataset_1>
        <Data>
            <Row>
                <Application>Word</Application>
                <Vendor>Microsoft</Vendor>
                <Homepage>https://microsoft.com</Homepage>
            </Row>
        </Data>
    </Dataset_1>
</EADATA>

The script template uses a table with a table header and a single row with the custom fields {Application}, {Vendor} and {Homepage}.
What must I do, that all results (Dataset_0 to Dataset_i) are rendered as rows into the table?

Thank you very much for any hint or tip!

Best regards,
Daiim

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
AFAIK you can only use one dataset per fragment (but with multiple rows)
You just repeat the <row>

Geert

Daiim

  • EA User
  • **
  • Posts: 51
  • Karma: +0/-0
    • View Profile
Thank you Geert, this was the point.  :D