For anyone trying to customize Jasper templates

Started by JanC, August 21, 2019, 06:51:34 AM

Previous topic - Next topic


Just a couple of remarks to document what I experienced working with Jasper templates and caused my some headaches

Sorting and Grouping

using the <sortField> to group for example the 'elements' report by type such that e.g. Business Objects are placed together will cause any subreport to show each elements properties to fail. The reason is, that the usage of a <sortField> will replace your datasource with a SortedDataSource. That datasource cannot be casted anymore to one of the Archi datasources (such as the ElementsDataSource) to use the getPropertiesDatasource() method.

Table of Contents - or working with Jasper Parts

Yes ... it can (almost) be done ... but what we need is the ability to Clone our ArchiMate datasource. Otherwise the data in the second 'part' is empty as the datasource is already being forwarded to its end. I hope that I will find some more time to complete my sample and to upload a few minor changes as suggestions such that this can be done in some future version

Reference to the actual model file (or its directory)

Creating multiple models I wanted to have the opportunity to have (background) images per model. Thus my thought was to work with filesystem directories and to place the images next to the model file. To get hold of the directory in Jasper is somewhat clumsy ... but it can be done as below

   <variable name="MODEL_FILE" class="java.lang.String" calculation="System">
   <variable name="MODEL_DIRECTORY" class="java.lang.String" calculation="System">

Phil Beauvoir

Jan, thanks for the information.

If you or anyone else has any proposals to change the underlying Data Source code to improve access to the model, best to take a look at the code we have now:

If you value and use Archi please consider making a donation!


That is indeed the code I am looking at - the 4.4 version though as I started some while ago. Guess that not too much changed, but of course I will take a look and send you suggestions.