October 12, 2011

October 10, 2011

Enable lookup in report parameters selection page

In this post I will show how to enable the lookup functionality for selecting one or multiple values in a report parameter.
Instead of creating a new lookup I will show all the necessary configurations looking at the built-in report 'Inventory Balance' (inventory_balance_tbl.rptdesign).

Enabling lookup in report

Open the 'Report Administration' application and search for 'Inventory Balance' report.
Open the report details page and look at the 'Parameters' section. The 'item' parameter is the right example that what we are searching for.



The three fields we intereded in are: Attribute Name, Lookup Name and Multi-Lookup Enabled.
The 'Attribute Name' specifies the database attribute on which we want to filter the results. The Inventory Balance report allows to specify one or more items.
The 'Lookup Name' specifies a Maximo system lookup that will be displayed to select the parameter's values. Just as a remainder, Maximo system lookups are available in the Application Designer through the action menu. In the chosen example the 'item' lookup will be displayed.
The 'Multi-Lookup Enabled' field specifies if the user can select multiple values in the lookup list that is displayed.
Clicking on 'Generate Request Page' and then on 'Preview' button. You will see the following request page.

BIRT report

To see how to handle the multiple values in the BIRT code open the report design file located under [SMP_INSTALL_FOLDER]\maximo\reports\birt\reports\INVENTOR.
In the 'open' method you will find the following lines:

if(params["item"].value) {
  params["where"]+= " and " + MXReportSqlFormat.createParamWhereClause("inventory.itemnum", params["item"].toUpperCase());
}


Using the createParamWhereClause function you can easily convert the items list passed by Maximo in the correct where clause.