Upgrade iReports to 6.0: Difference between revisions

From IMSMA Wiki
Jump to navigation Jump to search
Evinek (talk | contribs)
No edit summary
No edit summary
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Under construction|This page is under construction}}
{{TOC right}}
{{TOC right}}
== Introduction ==__NOEDITSECTION__
== Introduction ==__NOEDITSECTION__
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.
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:
{{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
* List - xxx, e.g. List - Land
* Geospatial - xx, e.g. Geospatial - Activity
* Geospatial - xx, e.g. Geospatial - Activity
* Statistics - xx, e.g. Statistics - Land with Ordnance Details
* Statistics - xx, e.g. Statistics - Land with Ordnance Details


[[File:Report_Template_Manager_custom_iReports.png|center|700px]]
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.
 
{|
In order to upgrade the identified custom iReport templates, the following steps need to be performed:
|- valign="top"
|
{|
|-
| [[File:Report_Template_Manager_custom_iReports.png|center|700px]]
<div align="center">
'' Customisation menu - Report Template Manager''
</div>
|
| [[File:Report List Window.png|center|700px]]
<div align="center">
'' Report menu - Report List Window ''
</div>
|}
In order to upgrade the identified custom iReport templates, the steps below need to be performed.


==Steps for upgrading iReport templates ==__NOEDITSECTION__
==Steps for upgrading iReport templates ==__NOEDITSECTION__
Line 18: Line 31:


=== Get the JRXML files of the iReport templates ===__NOEDITSECTION__
=== Get the JRXML files of the iReport templates ===__NOEDITSECTION__
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:
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
<ol>
* Open the table called '''reporttemplate''' or issue the following query:
<li> Use pgAdmin3 or Navicat to connect to the imsma database.</li>
<li> Open the table called ''reporttemplate'' or issue the following query:
<pre>
<pre>
SELECT * FROM reporttemplate ORDER BY name
SELECT * FROM reporttemplate ORDER BY name
</pre>
</pre></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> 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>
* 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> 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>
* Save the document as <name>.jrxml (not .txt, the extension needs to be .jrxml)
<li> Save the document as <name>.jrxml (not .txt, the extension needs to be .jrxml) in ''C:\IMSMAng\iReport\Templates\Report Templates''.</li>
* Open iReport
<li> Open iReport ([[IReport does not start]]).</li>
* Open the file saved before (<name>.jrxml) in iReport
<li> Open the file saved before (<name>.jrxml) in iReport.</li>
 
</ol>
=== Adapt the iReport templates ===__NOEDITSECTION__
=== Adapt the iReport templates ===__NOEDITSECTION__
The following adaptations can now be made to the iReport template:
The following adaptations can now be made to the iReport template:
==== Adapt the general report definition ====__NOEDITSECTION__
==== Adapt the general report definition ====__NOEDITSECTION__
* Switch to the XML view of the report:
<ol>
[[File:IReport XML View.png|center]]
<li> Switch to the XML view of the report:
* Delete all the lines that start with '''<import value='''
[[File:IReport XML View.png|center]]</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> Delete all the lines that start with '''<import value='''</li>
* Search for the tag '''queryString''' and ensure that the attribute '''language''' is set to ImsmaQuerylike this:
<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>
<pre>
<queryString language="ImsmaQuery">
<queryString language="ImsmaQuery">
</pre>
</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__
==== Adapt GUID fields ====__NOEDITSECTION__
* Switch back to the Designer view of the report
<ol>
* Expand the Fields in the Report Inspector and look for the field '''guid'''
<li> Switch back to the Designer view of the report.
[[File:iReport_guid_field.png|center]]
<li> 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'''
[[File:iReport_guid_field.png|center]]</li>
[[File:iReport_guid_properties.png|center]]
<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'''
* In the next dialog window, click '''Add'''
[[File:iReport_guid_properties.png|center]]</li>
* In the add/modify property window, add the following:
<li> In the next dialog window, click '''Add'''.</li>
** Property name: '''imsma.type'''
<li> In the add/modify property window, add the following:
** Property value: object name, e.g. '''HAZARD''' or '''HAZARD_REDUCTION''', etc. depending on the object (data source) that the report is defined on
:* 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]]
[[File:iReport_guid_properties_add.png|center]]
* Click OK twice to save and exit
<li> Click OK twice to save and exit.</li>
</ol>
==== Adapt SQL fields ====__NOEDITSECTION__
==== Adapt SQL fields ====__NOEDITSECTION__
SQL fields, if used in a report, need to be adapted in two ways:
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.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.
<ol>
* 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> 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__
==== 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:
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|center]]
[[File:Report_error_message.png|center]]
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.
==== Adapt labels====__NOEDITSECTION__
Labels might need to be adapted too due to language or that terms have changed e.g. from Mine Action Area Type to Land Classification.
[[Image:iReport fonts.png|center]]
=== 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:
* Compile the report in iReport {{Note|If there are errors, they are most likely not related to the upgrade.}}
<ol>
* Preview the report in iReport {{Note|If there are errors, they are most likely not related to the upgrade.}}
<li> Compile the report in iReport {{Note|If there are errors, they are most likely not related to the upgrade.}}</li>
* Import the iReport template into IMSMA
<li> Preview the report in iReport {{Note|If there are errors, they are most likely not related to the upgrade.}}</li>
* Adapt the report definition in IMSMA
<li> Import the iReport template into IMSMA.</li>
* Test the report by running it in IMSMA
<li> Adapt the report definition in IMSMA.</li>
* Delete the old reports and report templates in IMSMA
<li> Test the report by running it in IMSMA.</li>
<li> Delete the old reports and report templates in IMSMA.</li>
</ol>
{{NavBox Upgrade}}
{{NavBox Upgrade}}


[[Category:NoPublic]]
[[Category:NoPublic]]

Latest revision as of 12:40, 7 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.

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 steps below 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:

  1. Use pgAdmin3 or Navicat to connect to the imsma database.
  2. Open the table called reporttemplate or issue the following query:
    SELECT * FROM reporttemplate ORDER BY name
    
  3. 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
  4. 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).
  5. Save the document as <name>.jrxml (not .txt, the extension needs to be .jrxml) in C:\IMSMAng\iReport\Templates\Report Templates.
  6. Open iReport (IReport does not start).
  7. 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

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

Adapt Data Source

Choose the right data source. If you are not sure, look in the table in column Type.

Adapt GUID fields

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

Adapt SQL fields

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

  1. 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.
  2. The SQL query needs to be adapted to the PostgreSQL syntax. Check [|this 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.

Adapt labels

Labels might need to be adapted too due to language or that terms have changed e.g. from Mine Action Area Type to Land Classification.

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:

  1. Compile the report in iReport
    If there are errors, they are most likely not related to the upgrade.
  2. Preview the report in iReport
    If there are errors, they are most likely not related to the upgrade.
  3. Import the iReport template into IMSMA.
  4. Adapt the report definition in IMSMA.
  5. Test the report by running it in IMSMA.
  6. 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 =
 }}
}}

}}}}}}