Creating a parameter validation event URL

Use the information in this section to create a valid Parameter Validation Event program and to define the URL value in Reporting Services. For more information about adding a Parameter Validation Event to a report, see Adding or modifying events.

The URL that you create is a user-defined program application for validating the report's parameters. In order to pass user-defined request parameters to the user-defined report parameter validation application, the URL supports query string as a part of the type URL value. For example, "?domaingrp=finance" concatenated to the end section of the URL.

Note: Reporting Services invokes the URL and passes the request parameters using the POST method. The end user's web server must be enable to accept POST methods.

In addition to the request parameters that Reporting Services always passes to your event program, you can have Reporting Services pass user-defined request parameters by concatenating them to the URL value as a query string. The following example contains a query string that passes the user-defined request parameter mytestgroup and its value: http://myHost:9000/context/ParameterValidator?mytestgroup=finance.

Before using variables as part of the URL value, note the following:

  • Variables are case-sensitive.
  • You must use the at sign (@) before the variable. You must type double angle brackets around the variable. For example, <<@your_variable>>.
  • You can only specify user variables that are defined as the literal type.
  • You can specify system variables that are shipped with the Reporting Services product.

Reporting Services Passed In Request Parameters

This table shopws the request parameters that Reporting Services automatically passes with the URL that you specify.

Parameter Description
reportparams This request parameter contains the complete list of the report parameters in a name/value pair format. The format of the passed in data is Name1=Value1~Name2=Value2~Name3=Value3 where Name represents a report parameter name and Value represent the report parameter value selected or entered by the user for this report request. The tilde (~) character is used as a delimiter to separate multiple passed in report parameters.

For report parameters that allow their value to be null (blank) and have been selected to be blank by the user requesting to view the report, the passed in report parameter will be of the format Name=. For example, reportparams=Cost Center= states the report parameter named Cost Center has a null or blank value. The pipe ( | ) character is used as a delimiter for the case when a report parameter has been selected to contained multiple values. For example, reportparams=Company=ABC|EFG|LMN states the report parameter named Company has the three values of ABC, EFG, and LMN.

reportnam This request parameter represents the name of the report given when it was published to the Reporting Services repository.
userid This request parameter represents the name of the Reporting Services user requesting to view the report.

Reporting Services Values to be Passed Back to Reporting Services

A user-defined application must return a status to the Reporting Services to indicate whether to display the report to the user. The following table contains the response items to pass back to Reporting Services as a single concatenated string value.

Item Description
status Set the status value to zero (status=0) if passed in report parameters have been validated and the user is allowed to view the report.

Set the status to a non-negative value greater than zero when the validation has failed and you want to display an error message to the user.

message Optionally, the message item contains the text describing the error corresponding to a the specified status. When activated, Reporting Services displays the error message View screen.

The items passed back to Reporting Services must be passed back as a single string. The item must be passed back by writing them to an OutputStream retrieved from the HttpServletResponse object.

This is a code sample:

Java code status and message snippet examples in a user 
defined report parameter validation application:

// Perform report parameter validation work unique to the user defined 
// application

// Found an error during report parameter validation check, so define 
// status as failed and add an 
// error message describing the found error.
String returnStatus = "status=100&message=" + errorMsgString;

// Did not find an error during report parameter validation check, so 
// define status as passed.  Adding a message optional for the pass 
// condition – LBI ERS will ignore the message if the status is 
// returned as passed.
String returnStatus = "status=0";

// Send the status string (possibly with an error message) back to the 
// LBI ERS web application by using or writing to the OutputStream 
// retrieved from the HttpServletResponse object.
PrintWriter out = response.getWriter();