Upgrade iReports to 6.0: Difference between revisions

From IMSMA Wiki
Jump to navigation Jump to search
Evinek (talk | contribs)
No edit summary
Evinek (talk | contribs)
No edit summary
Line 61: Line 61:
However, check first that the right data source is used indeed.
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.
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__
=== 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:
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:

Revision as of 17:09, 1 July 2015

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.

IMSMA V6 comes with 35 inspirational iReport templates. Therefore, if there are more than 35 in the Report Template Manager, 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 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. To be able to do so, the related .jrxml files need to be extracted from the database. 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)
  • Open 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:

File:IReport error message.png

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 = 
 }}
}}

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

{{{list2}}}

}}{{#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 = 
 }}
}}

}}}}}}|}}{{#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 = 
 }}
}}

}}}}}}