Upgrade iReports to 6.0

From IMSMA Wiki
Revision as of 18:06, 6 July 2015 by Alnaucler (talk | contribs)
Jump to navigation Jump to search

Introduction

When upgrading IMSMA from 5.08.04 to V6, the iReport templates, if there are any, need to be upgraded separately - this is not included in any automatic process. Custom report templates as well as created reports will be transferred to V6, but they will not be working/usable. In order to make them usable, follow the steps as described on this page.

IMSMANG version 6.0 comes with 35 inspirational iReport templates. Therefore, if there are more than 35 in the Report Template Manager in the Customisation menu, it means that custom ones have been created by the country, and need to be investigated one by one. The names of all the inspirational iReport templates start with either:

  • List - xxx, e.g. List - Land
  • Geospatial - xx, e.g. Geospatial - Activity
  • Statistics - xx, e.g. Statistics - Land with Ordnance Details

In IMSMANG version 6.0 there are 3 Report definitions. Therefore, if there are more than 3 in the Report List Window in the Report menu, it means that the custom Report definitions have been done by the country. After the iReports templates themselves have been upgraded then the templates have to be tested with their Saved Searches.

}}{{#if:|<td style="text-align:left;border-left-width:2px;border-left-style:solid;|}}{{#if:|{{#if:IMSMA Hub{{#switch:{{#if:|{{{border}}}|child}}|subgroup|child=|none=|#default=

Customisation menu - Report Template Manager

Report menu - Report List Window

In order to upgrade the identified custom iReport templates, the following steps need to be performed:

Steps for upgrading iReport templates

Prerequisites

As a first step, it is useful to check whether the iReport templates and the actual reports were working in IMSMA 5.08.04. If not, it might not be sufficient to apply the upgrade steps described below, but additional adaptations might be needed. In general, if a template was not working in the previous IMSMA version, it was most probably not used. In this case, it seems better to liaise with the focal point in country to check which report templates are really needed.

Get the JRXML files of the iReport templates

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:

  • Use pgAdmin3 or Navicat to connect to the imsma database
  • Open the table called reporttemplate or issue the following query:
SELECT * FROM reporttemplate ORDER BY name
  • 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
  • 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)
  • Save the document as <name>.jrxml (not .txt, the extension needs to be .jrxml) in C:\IMSMAng\iReport\Templates\Report Templates.
  • Open iReport (Problem starting iReport)
  • Open the file saved before (<name>.jrxml) in iReport

Adapt the iReport templates

The following adaptations can now be made to the iReport template:

Adapt the general report definition

  • Switch to the XML view of the report:
  • Delete all the lines that start with <import value=
  • 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)
  • Search for the tag queryString and ensure that the attribute language is set to ImsmaQuerylike this:
<queryString language="ImsmaQuery">

Adapt GUID fields

  • Switch back to the Designer view of the report
  • Expand the Fields in the Report Inspector and look for the field guid
  • If a guid field exists, select it and, in the Properties window on the right-hand side, click on the dots next to Properties
  • In the next dialog window, click Add
  • 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
  • Click OK twice to save and exit

Adapt SQL fields

SQL fields, if used in a report, need to be adapted in two ways:

  • The need to be renamed from com.fgm.imsma.ext.report.xxxto 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.
  • The SQL query needs to be adapted to the PostgreSQL syntax. Check [page] for more details.

Adapt field names

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

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

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:

  • Compile the report in iReport
If there are errors, they are most likely not related to the upgrade.
  • Preview the report in iReport
If there are errors, they are most likely not related to the upgrade.
  • Import the iReport template into IMSMA
  • Adapt the report definition in IMSMA
  • Test the report by running it in IMSMA
  • Delete the old reports and report templates in IMSMA
{{#switch:|subgroup|child=|none=|#default=}}{{#if:|}}{{#if:Upgrade Process|<td style="text-align:left;border-left-width:2px;border-left-style:solid;|{{#if:|}}}}{{#if:|{{#if:IMSMA Hub{{#switch:{{#if:|{{{border}}}|child}}|subgroup|child=|none=|#default=}}{{#ifeq:|Template|{{#ifeq:{{#if:|{{{border}}}|child}}|child||{{#ifeq:{{#if:|{{{border}}}|child}}|subgroup||{{#switch:upgrade ireports to 6.0
doc sandbox testcases = #default = {{#switch: plainlist hlist hlist hnum hlist vcard vcard hlist = #default =
 }}
}}
}}}}}}|
{{{group2}}}

}}{{#ifeq:|Template|{{#ifeq:{{#if:|{{{border}}}|child}}|child||{{#ifeq:{{#if:|{{{border}}}|child}}|subgroup||{{#switch:upgrade ireports to 6.0 doc sandbox testcases = #default = {{#switch: plainlist hlist hlist hnum hlist vcard vcard hlist = #default =

 }}
}}

}}}}}}|}}{{#if:|{{{group3}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list3}}}

}}{{#if:|{{#if:|{{{group4}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list4}}}

}}{{#if:|{{#if:|{{{group5}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list5}}}

}}{{#if:|{{#if:|{{{group6}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list6}}}

}}{{#if:|{{#if:|{{{group7}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list7}}}

}}{{#if:|{{#if:|{{{group8}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list8}}}

}}{{#if:|{{#if:|{{{group9}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list9}}}

}}{{#if:|{{#if:|{{{group10}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list10}}}

}}{{#if:|{{#if:|{{{group11}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list11}}}

}}{{#if:|{{#if:|{{{group12}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list12}}}

}}{{#if:|{{#if:|{{{group13}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list13}}}

}}{{#if:|{{#if:|{{{group14}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list14}}}

}}{{#if:|{{#if:|{{{group15}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list15}}}

}}{{#if:|{{#if:|{{{group16}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list16}}}

}}{{#if:|{{#if:|{{{group17}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list17}}}

}}{{#if:|{{#if:|{{{group18}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list18}}}

}}{{#if:|{{#if:|{{{group19}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list19}}}

}}{{#if:|{{#if:|{{{group20}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list20}}}

}}{{#if:|{{#if:IMSMA Hub{{#switch:{{#if:|{{{border}}}|child}}|subgroup|child=|none=|#default=

}}{{#ifeq:|Template|{{#ifeq:{{#if:|{{{border}}}|child}}|child||{{#ifeq:{{#if:|{{{border}}}|child}}|subgroup||{{#switch:upgrade ireports to 6.0 doc sandbox testcases = #default = {{#switch: plainlist hlist hlist hnum hlist vcard vcard hlist = #default =

 }}
}}

}}}}}}|}}

{{{below}}}

}}{{#switch:|subgroup|child=

|none=|#default=}}{{#ifeq:|Template|{{#ifeq:|child||{{#ifeq:|subgroup||{{#switch:upgrade ireports to 6.0 doc sandbox testcases = #default = {{#switch:hlist plainlist hlist hlist hnum hlist vcard vcard hlist = #default =
 }}
}}

}}}}}}