</div>
|}
In order to upgrade the identified custom iReport templates, the following steps below need to be performed:.
==Steps for upgrading iReport templates ==__NOEDITSECTION__
=== Get the JRXML files of the iReport templates ===__NOEDITSECTION__
The templates that shall be upgraded need to be opened with iReport. If the .jrml files were '''not''' included in the backup then you may extract them from the database with the following steps are required:
* <ol><li> Use pgAdmin3 or Navicat to connect to the imsma database.</li>* <li> Open the table called ''reporttemplate'' or issue the following query:
<pre>
SELECT * FROM reporttemplate ORDER BY name
</pre></li>* <li> Navigate to the right row (corresponding to the report template name you are looking for) and copy the content of the column called '''jrxml'''. The content of this column starts with <?xml version=1.0</li>* <li> Paste the text into e.g. Notepad++ and ensure that there are no double quotes (") at the very beginning and end of the text (this happens when you copy-paste from pgAdmin3 - in this case delete the double quotes).</li>* <li> Save the document as <name>.jrxml (not .txt, the extension needs to be .jrxml) in ''C:\IMSMAng\iReport\Templates\Report Templates''.</li>* <li> Open iReport ([[IReport does not start]]).</li>* <li> Open the file saved before (<name>.jrxml) in iReport.</li></ol>
=== Adapt the iReport templates ===__NOEDITSECTION__
The following adaptations can now be made to the iReport template:
==== Adapt the general report definition ====__NOEDITSECTION__
* <ol><li> Switch to the XML view of the report:[[File:IReport XML View.png|center]]</li>* <li> Delete all the lines that start with '''<import value='''</li>* <li> Change '''language="java"''' to '''language="groovy"''' in the attribute list of the tag '''jasperReport''' at the top of the document (just search for language to find the place).</li>* <li> Search for the tag '''queryString''' and ensure that the attribute '''language''' is set to ImsmaQuerylike this:
<pre>
<queryString language="ImsmaQuery">
</pre></li></ol>
==== Adapt Data Source ====__NOEDITSECTION__
Choose the right data source. If you are not sure, look in the table in column ''Type''.
==== Adapt GUID fields ====__NOEDITSECTION__
* <ol><li> Switch back to the Designer view of the report.* <li> Expand the Fields in the Report Inspector and look for the field '''guid'''[[File:iReport_guid_field.png|center]]</li>* <li> If a guid field exists, select it and, in the '''Properties''' window on the right-hand side, click on the dots next to '''Properties'''[[File:iReport_guid_properties.png|center]]</li>* <li> In the next dialog window, click '''Add'''.</li>* <li> In the add/modify property window, add the following:*:* Property name: '''imsma.type'''*:* Property value: object name, e.g. '''HAZARD''' or '''HAZARD_REDUCTION''', etc. depending on the object (data source) that the report is defined on
[[File:iReport_guid_properties_add.png|center]]
* <li> Click OK twice to save and exit.</li></ol>
==== Adapt SQL fields ====__NOEDITSECTION__
SQL fields, if used in a report, need to be adapted in two ways:
* <ol><li> The need to be renamed from ''com.fgm.imsma.ext.report.xxx'' to e.g. ''HazardSQLField''. In order to be sure about the spelling, an empty report containing all fields of a data source can be created, which then allows to copy-paste fields from this empty report into the ones that is being upgraded.</li>* <li> The SQL query needs to be adapted to the PostgreSQL syntax. Check [[http://mwiki.gichd.org/IM/Difference_MySQL_PostGreSQL#Most_common_changes_in_queries_and_views_from_MySQL_to_PostgreSQL|this page]] for more details.</li></ol>
==== Adapt field names ====__NOEDITSECTION__
Some IMSMA field names have changed from 5.08.04 to V6. The following error message (when trying to preview the report) can be an indication for that:
However, check first that the right data source is used indeed.
There is no exhaustive list of all changes yet, but please get in touch with VIE in case of doubt.
==== Adapt variables ====__NOEDITSECTION__
In case variables are defined and using fields that have been changed (e.g. SQL fields or fields whose name has changed), then they need to be adapted accordingly.
=== Test and import into IMSMA ===__NOEDITSECTION__
Once all those changes have been made, the report should be ready to run in V6. Finalise the upgrade by carrying out the following steps:
* <ol><li> Compile the report in iReport {{Note|If there are errors, they are most likely not related to the upgrade.}}</li>* <li> Preview the report in iReport {{Note|If there are errors, they are most likely not related to the upgrade.}}</li>* <li> Import the iReport template into IMSMA.</li>* <li> Adapt the report definition in IMSMA.</li>* <li> Test the report by running it in IMSMA.</li>* <li> Delete the old reports and report templates in IMSMA.</li></ol>
{{NavBox Upgrade}}
[[Category:NoPublic]]