InetSoft Reporting Software: Report Parameter Retrieval

The next step is needed to add code in the report creation routine to retrieve the parameter values. Each set of parameter values is packaged into a RepletRequest object. The parameter values can be retrieved using one of the 'get' methods.

'get' Method

Description

RepletRequest.getParameter()

Retrieve a parameter value as an object. This general-purpose access method works on any parameter type. The type of the object returned from this method depends on the declared type of the parameter.

RepletRequest.getBoolean()

Retrieve a boolean value (for boolean). If the value is not boolean, return true if the value is not null, false otherwise.

RepletRequest.getString()

Retrieve a string value (for text, text area). If the value is null, return an empty string.

RepletRequest.getInt()

Retrieve an integer value. If the value is null, it returns zero.

RepletRequest.getDouble()

Retrieve a double value. If the value is null, it returns zero.

RepletRequest.getArray()

Retrieve an object array (for list and option selections).

RepletRequest.getDate()

Retrieve a date (for date parameter). If the value is not a Date type, it converts it to string and parse it using the default date formats (configurable as a property).

RepletRequest.getTime()

Retrieve a time as a Date object (for time parameter). If the value is not a Date type, it converts it to string and parses it using the default time formats (configurable as a property).

 

RepletRequest Get Methods

Each 'get' method takes the parameter name as the argument and returns the appropriate value for the specified parameter. The request name in the RepletRequest object is the same as the request name in the corresponding RepletParameters object. The program can check the request name to see which request the parameters are associated with.

public ReportSheet createReport(RepletRequest req) {
   if(req.getBoolean("Sort Table")) {
      // sort table
   }
   ...
}


Passing an HTML Document as a Parameter

The setRequestDialogHTML method can be used to pass an HTML document or an HTML segment. The HTML can be specified in three forms.

• The string can be a resource path pointing to an HTML file. In this case the file is loaded in and used as the prompt dialog.

• The string can contain the entire contents of the HTML.

• The string can contain a segment of HTML. The segment is added to the bottom of the auto-generated prompt dialog. The engine checks for the presence of a <body> tag to determine if the HTML string is a segment or a complete document.

If the dialog is set, the HTML is used to prompt user input when viewing reports in a browser. Otherwise, the report engine generates a request dialog. The HTML page must contain a form that meets the following requirements:

• the form action field must be '$(servlet.uri)'

• the form target field must be '$(request.target)'

• the form contains a hidden field with name 'ID' and value '$(replet.id)'

• the form contains a hidden field with name 'req' and value '$(request.name)'

• the form contains a hidden field with name 'op' and value 'Generate'

• the form contains fields for the parameter values, where the name of each field must match the parameter field name






Read Dashboard Reviews



View 2-min Dashboard Demo



Register for Pricing

The form is responsible for closing the form window when the form is submitted. Use an onClick 'Handler'.

<input type=button value="OK" onClick="submit(); window.close();">

 

Previous: Report Parameter Types