Use any number of custom tags during report generation

The report generator allows you to configure any number of custom tags for the entire project. 
In order to use these custom tags in an RTF template, the value of this tag can now be inserted in an RTF template at any point via the context menu [Project Constants> <ConstantName>].

 

 

ood. However, if we now want to define constants that are not intended for the entire project, but for a particular document, we find [Report Constants] in the context menu under the [Project Constants] entry. This allows us to access a list of predefined tags for the report. This list can not be extended as desired!

However, the values can be set with the use of virtual documents (package with stereotype << masterDocument >> and class with the stereotype << modelDocument >>).

A manual addition of additional tags to the package with stereotype << master document >> and class with the stereotype << model document >> has no effect! In subsequent EA versions, it will hopefully be possible to extend this list as desired. Until then, we can work with the following workaround.

Tagged Values of a specific model element as a report constant

To define report constants, we simply create a model element, For example, a class (My Report Constants) and add any Tagged Values to that class. Of course we can use all other properties of this class as well.

In our Virtual Document (MyDocument) we create a ModelDocument (MD1). Instead of drag&drop a package into the ModelDocument to generate the content of this package, we configure a model search.

With the model search, we now look for the model element My Report Constants. In this example, I have saved the GUID of the model element as a keyword of the model element. The query huilder serach queries now exactly this element with this keyword. This workaround is necessary because the query-builder search can not search for the GUID of a model element.

As a result, we now get the model element My Report Constants.

In the Tagged Value RTFTemplate, which is configured in MD1, we can now access everything from the model element My Report Constants.

Schematische Darstellung des Beispiels

Alternative: A more simple alternative is to drag a package into the ModelDocument MD1 to access the content.

Use Model Elements Tags in Header/Footer

In the RTFTemplate HeaderAndFooter, we open the header / footer area under [Document Edit> Edit> Page Header / Footer> Edit Page Header / Footer].

 

 

We place the cursor in the header and select element in the left tree. We select [ChildPackage] and [ChildElement] again!

Between the yellow element tags in the RTF template, we now insert the tagged values via the context menu [InsertFiled > Value of], which we want to output in the header.

As a result, we get the header defined on the RTFTemplate on each page:

 

 

Note: If an RTFTemplate is already used in the master document, which already defines a header, this header is applied to all other generated pages!

 

 

Limitations:

Unfortunately, this approach can not currently be used in Cover Page Templates and Table of Content Templates.

We can either use the header or the footer to put the Package and Element yellow tags to get the TaggedValues of the queries element. Of course, both, header and footer can be output. However, the respective data can only be queried once from the model, for the header or footer. For the other header / footer we can use the Project Constants or Report Constants.

Posted in Document Generation, Enterprise Architect, Model Search