Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: MichaelJ on July 07, 2020, 12:38:48 am
-
Hi everyone,
We have attempted to reference document artefact content (not templated, just plain RTF content like "Project Summary") with no luck. A few cases we've investigated include:
- Referenced from inside a custom document template
Only via "linked documents" - Referenced via a Report Package
Does not show up unless template selection is "Model Report" (outcome is not what we're looking for) - Referenced via a Document Model
Only via "linked documents" or "notes" - Insert the content into any report we wish to generate, and at any "section" of the report
A few observations:
- "Linked Documents" - printed in custom reports only when the user enables "Linked Documents" from the "Package/Element" hierarchy section within a specific template.
This assumes the "Project Summary" linked document is associated to each specific element/package to be reported on.
Currently, we were only able to attach linked documents directly to the element and not (preferred) through a reference;
- "Document Templates" - based on model searches, elements or packages; the Project Summary content does not relate to any model element or package
- "Document Script" - require use of DocumentGenerator class and the GetDocumentAsRTF and other DocumentXXX(...) methods.
There is a LoadDocument(...) or LoadTemplate(...) method, so perhaps these will work? - "Report Package" - seems to be the right way to proceed, however we're not able incorporate document artefact content into the report package unless we override the [Document Generation] template selection to "Model Report" - doing so does report the document artefact content, but negates use of templates for remaining packages in the Report Package
We would like to generate different documents, each that contains the content found in the "Project Summary" and prefer to stay away from copy-pasting this content into each type of report.
Is there a way in Sparx EA to include document artefact content into a generated custom report AS-IS before any template content?
-
Yes that is possible.
What we do is create a document artifact for this type of info.
Then we use a virtual document for our document generation, and include a model document that references this document artifact using a search.
In the parameter we put the guid.
The search we use is a simple ElementByGUID search that returns the element with the guid in the search term:
select c.ea_guid AS CLASSGUID,c.object_type AS CLASSTYPE,c.name AS Name, c.stereotype AS Stereotype ,package.name AS PackageName ,package_p1.name AS PackageLevel1,package_p2.name AS PackageLevel2,package_p3.name AS PackageLevel3
from ((((t_object c
inner join t_package package on c.package_id = package.package_id)
left join t_package package_p1 on package_p1.package_id = package.parent_id)
left join t_package package_p2 on package_p2.package_id = package_p1.parent_id)
left join t_package package_p3 on package_p3.package_id = package_p2.parent_id)
where
c.ea_guid like '<Search Term>'
Geert
-
Hi Geert,
Thank you for your repsonse, it's much appreciated and tremendously helpful.
We performed the following steps as described:
- Create a new model search (code supplied) and save it
- Create a document artefact and add the required text to the artefact
- Create a model document, set the "Search Value" to the GUID of the document artefact, set the "Search Name" to the search created in (1)
- Add a new report package and add the document model from (3)
- Generate the report for the virtual document
When generating the report for the virtual document, EA requires a template to be assigned to the document model. By default this is "Model Report" which means the generated report contains basic class details of the document model class element and thereafter the document artefact details. If we chose to NOT use a document template, EA still defaults to "Model Report".
I suppose resolving EA's need for a template could be resolved by creating a new template with *zero* section content specified?
-
We use a a very simple template that only inlcudes
package>
element>
linked document>
Geert
-
Good to know that, thank you.