Using a parameter component
The actuate.Parameter class is a container for Actuate report parameters. Create an instance of the actuate.Parameter class using JavaScript, as shown in the following code:
var myParameters = new actuate.Parameter( "param1" );
The value of the "param1" parameter is the name value for the <div> element that holds the report parameters display. The page body must contain a <div> element with the param1 id, as shown in the following code:
<div id="param1"></div>
Use setReportName( ) to set the report from which to retrieve parameters, as shown in the following code:
myParameters.setReportName("/public/customerlist.rptdesign");
The setReportName( ) function takes the path and name of a report file in the repository as the only parameter. In this example, "/public/customerlist.rptdesign" indicates the Customer List report design in the /public directory.
To download the parameters and display them in a form on the page, call parameter.submit( ), as shown in the following code:
myParameters.submit(processParameters);
The submit( ) function submits all of the asynchronous operations prepared by the calls to parameter functions. The submit function also triggers an AJAX request to download the report parameters to the client. The Actuate web application sends the requested report parameters and the page displays them as a form in the assigned <div> element. The submit( ) function takes a callback function as a parameter, shown above as processParameters.
The following code example calls parameter in the callback function for actuate.initialize( ) to display a parameter:
<div id="param1">
  <script type="text/javascript" language="JavaScript"
    src="http://localhost:8700/iportal/jsapi"></script>
 
  <script type="text/javascript" language="JavaScript">
  function init( ){
    actuate.load("viewer");
    actuate.load("parameter");
    actuate.initialize( "http://localhost:8900/iportal", null,null, null, displayParams);
  }
  function displayParams( ) {
    param = new actuate.Parameter("param1");
    param.setReportName("/Public/BIRT and BIRT Studio Examples/Customer Order History.rptdesign");
    param.submit(function ( ) { this.run.style.visibility='visible';});
  }function processParameters( ) {
    …
  }
</script></div>
The parameter component displays all of the parameters of the report in a form. When the parameters page is larger than the size of the viewer, the viewer provides scroll bars to navigate the parameters page.
To retrieve the parameters, use actuate.Parameter.downloadParameterValues( ). This function takes a callback function as an input parameter. The callback function processes the parameter values, as shown in the following code:
function processParameters( ) {
  myParameters.downloadParameterValues(runReport);
}
The downloadParameterValues( ) function requires the callback function to accept an array of parameter name and value pairs. The API formats this array properly for the actuate.Viewer class.

Additional Links:

Copyright Actuate Corporation 2012