Accessing parameter values from the Viewer
The actuate.Viewer.setParameterValues( ) function adds the parameters set by the user to the viewer component. The setParameterValues( ) function takes as an input parameter an object composed of variables whose names correspond to parameter names. The downloadParameterValues( ) function returns a properly formatted object for use with actuate.Viewer.setParameterValues( ). The following code example shows how to call downloadParameterValues( ) and move the parameter name and value array into the Viewer with actuate.Viewer.setParameterValues( ):
function runReport(ParameterValues){
  var viewer = new actuate.Viewer("viewerpane");
  viewer.setReportName("/Public/BIRT and BIRT Studio Examples/Customer Order History.rptdesign");
  viewer.setParameterValues(ParameterValues);
  viewer.submit( );
}
When the viewer calls submit( ), the client transfers the parameters to the server with the other asynchronous operations for the Viewer.
The following code example shows a custom web page that displays parameters and then shows the report in a viewer using those parameters:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <meta http-equiv="content-type" content="text/
    html;charset=utf-8" />
  <title>Viewer With Parameters Page</title>
</head>
<body onload="init( )">
  <div id="parampane">
  <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:8700/iportal", null,null, null, displayParams);
  }
  function displayParams( ) {
    param = new actuate.Parameter("parampane");
    param.setReportName("/Public/BIRT and BIRT StudioExamples/Customer Order History.rptdesign");
    param.submit(
        function ( ) {this.run.style.visibility = 'visible';});
  }
  function processParameters( ) {
    param.downloadParameterValues(runReport);
  }
  </script>
  </div>
  <hr><br />
  <input type="button" class="btn" name="run"
    value="Run Report" onclick="processParameters( )"
    style="visibility: hidden">
 
  <div id="viewerpane">
  <script type="text/javascript" language="JavaScript" src="http://localhost:8700/iportal/jsapi"></script>
  <script type="text/javascript" language="JavaScript">
  function runReport(paramvalues) {
    var viewer = new actuate.Viewer("viewerpane");
    viewer.setReportName("/Public/BIRT and BIRT StudioExamples/Customer Order History.rptdesign");
    viewer.setParameterValues(paramvalues);
    viewer.submit( );
  }
  </script>
  </div>      
</body>
</html>
The code in the example uses the administrator user credentials and the default report installed with a standard installation of Information Console. The default report is at the following path:
/Public/BIRT and BIRT Studio Examples/Customer Order History.rptdesign

Additional Links:

Copyright Actuate Corporation 2012