IBM Support

Creating an Unbound BIRT Report Parameter Lookup

Technical Blog Post


Abstract

Creating an Unbound BIRT Report Parameter Lookup

Body

Recently I encountered a Maximo user who requested for a report parameter lookup to be added to a BIRT Report request page. Not just any parameter, but an unbound Location(s) parameter lookup that was to only show and display records subject to the Location being specified on the request page. Upon initial setup of the Table Domain and simple lookups.xml modification, the goal was partially reached but the lookup was returning ALL locations and not those subject to the Table Domain.

Within our Report Development Guide(s) (http://ibm.biz/BdE2pA) we note that for modifying existing lookup attributes which do not have a required field class, or the field class is not configured to provide the expected values, one can achieve the desired results by creating a copy of the lookup and specifying a value for the mboname attribute. However, this did not entirely satisfy my client's needs and thus we needed to explore other options.

The resolution resorts back to the initial attempt, Table Domain and lookups.xml modification. See the example and steps below.

User Request
Location selection needs to be filtered by building (Top Level: BR200, BR400, etc)

Objective
Customize the LOCATION(S) lookup field to only show and display records from the query below:

select location, description from locations where location like 'BR%' order by location

Steps
1) Create Table Domain (ie. BRLOCATION):

Object: LOCATIONS
List Where Clause: LOCATION = 'BR%'

2) Export lookups.xml from Application Designer

3) Open lookups.xml in a text editor and search for keyword "lmolist" and add the following text below the "lmolist" section:

<table id="brlocation" inputmode="readonly" orderby="location" selectmode="single" whereclause="location like 'BR%'">
    <tablebody displayrowsperpage="20" filterable="true" filterexpanded="true" id="brlocation_lookup_tablebody">
    <tablecol dataattribute="location" id="brlocation_lookup_tablebody_col_2" mxevent="selectrecord" mxevent_desc="Go To %1" sortable="true" type="link"/>
</tablebody>

4) Save lookups.xml and import the file into Application Designer

5) Open the report you wish to modify within Report Administration and add the Location parameter:

Parameter Name: Location
Attribute Name: location
Lookup Name: brlocation
Display Name: Location(s)
Multi-Lookup Enabled: Checked
Default Value: =BR%

6) Save the record and select "Generate Request Page"

7) Test and preview the report by specifying your Location in the newly created parameter lookup and running the report.

 


*Note:  You may find this to be a trial-and-error process since the lookup behavior is controlled by field classes, which are classes that are assigned to the attribute definition in Database Configuration.

Many of the default lookups may not work correctly when applied to report parameters, either because there is no field class for the bound attribute, or because there is logic in the field class that limits the results of the lookup. In these cases,  the lookup may return no results, a subset of the expected results, or may contain Invalid Bindings.

With this method, you simply try out the lookup(s) you identify as possible candidates and evaluate whether they return the desired results. You can use SQL logging to examine the query used to populate the lookup to ensure there are no inappropriate filters applied.

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSLKT6","label":"IBM Maximo Asset Management"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

UID

ibm11130529