BIRT: Pass Parameters from Parent Dataset to Child Dataset

When developing BIRT reports, you will eventually come across a time when you need to pass a value from a parent data set query and use it as a parameter to in a child data set.  For example, within a PO report, you can create a data set that queries the PO record and then create another child data set to query the PO lines.  In this scenario, you will want to pass the POID or PONUM to the child data set to get the lines.

In this example, I have two data sets like so:

BIRT params 1

To define a parameter you want to use, we need to configure them on the child data set.  Right click on the ‘poLinesDataSet’ and click ‘Edit’.  On the left side, select ‘Parameters’.  Here you want to click ‘Add New’ and specify the name of the parameter.  It can be anything you want, in this case, I named it POID.

BIRT params 2

Set the direction to ‘Input’ and default value t0 zero.  Lastly, set the data type to ‘String’.  This is very important!  Even though the POID is defined as a long integer value in the database, if you specify this value as an ‘Integer’, there will be some cases where your parameter won’t work because the value exceeds the max value of an integer.  So using it as a string should guarantee that it works.  Save and hit OK.

Next, you can add the ‘poLinesDataSet’ to the report by clicking and dragging it to the form designer.  Once on the form, right click on the table and click ‘Edit Data Binding’.

BIRT params 3

Click ‘Dataset Parameter Binding’, select the parameter and ‘Edit’.  In this dialog, you can use the tool to select the value you want to pass from the parent data set to this child data set.  In this case, I choose to select the POID value from the parent data set.

BIRT params 4

Click Ok.  Now the next step is to open the script for the child data set so we can use the inbound parameter.  To access the parameter, you can use a variable named ‘inputParams’.  So to get the value, we can write:

var parentPoId = inputParams['POID'];

You can use the SQL binding like so:

poLinesDataSet = MXReportDataSetProvider.create(this.getDataSource().getName(), this.getName());;

var sqlText = new String();

// Add query to sqlText variable.

// Exclude the Maximo where clause
//sqlText += " where " + params["where"];

// Debug


As you can see in line 10, I also followed the “golden rule”.

Did You Know...

As Maximo Experts, we have developed several add-on products for Maximo that mobilize the work force, simplifies assignments, provides ad-hoc reporting capabilities and facilitates the seamless integration of Service Requests into Maximo.

Check out our products by clicking on the following links: EZMaxMobileEZPLanner and EZInsight.

Find Out More

5 thoughts on “BIRT: Pass Parameters from Parent Dataset to Child Dataset

  1. In PO, or any revision enabled mbo, I would recommend always using the id attribute to bind parent to child. Also, as you pointed out, casting the id value as a string will save time and aggravation down the road. Brian

  2. i couldnt get it worked.. my bad.

    my requirement is to create a report in a loop.
    so i have two tables
    one is master with the unique key referred in child details table.
    master table : mtbl
    client details table : childtbl

    what i am looking is to read each record one by one from master table and based on the each unique record from mastertbl the details will be fetched from the child table based on the key passed from master table. i.e. the report in a loop.

    how can I approach this ? sorry I am new bee to Birt report.

    – Ganesh

  3. Hi, I have an query. is that possible to get the parameter values by another .For example . By selecting country I need to get state and city at the same time

Leave a Reply