Reading and writing parameter values
You can use scripts to read and write current parameter values for report and Reportlet gadgets. The thisGadget object uses the getCurrentReportParameters() function to view and change report parameters.
Scripts support the following actions:
Set conditions for the using a data selection value.
Change the value of the linked data selection.
Change the parameter value of the report or Reportlet gadget.
For example, a dashboard developer makes a report gadget to display country information in a BIRT design file. The developer expects users to select a country from a linked list gadget. The BIRT design file has parameters for Country, State and City but the developer only wants to show country information.
Listing 6‑1 shows a script to remove current parameter values for State and City, as shown in the following sample script.
Listing 6‑1 Example script for reading and writing report parameters
var params = thisGadget.getCurrentReportParameters();
for ( var i = 0; i < params.length; i++ )
{
var param = params[i];
if ((param.getName() == 'State') || (param.getName() == 'City'))
{
param.setValue('');
param.setValueIsNull(true);
data.runReport = false;
}
}