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 42: Line 42:
</pre>
</pre>
==== Adapt GUID fields ====__NOEDITSECTION__
==== Adapt GUID fields ====__NOEDITSECTION__
* Switch back to the Designer view of the report
* Expand the Fields in the Report Inspector and look for the field '''guid'''
[[File:iReport_guid_field.png|center]]
* 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]]
* 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
[[File:iReport_guid_properties_add.png|center]]
* Click OK twice to save and exit
==== Adapt SQL fields ====__NOEDITSECTION__
==== Adapt SQL fields ====__NOEDITSECTION__



Revision as of 16:36, 1 July 2015

This page is under construction

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

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

}}}}}}