SAP Knowledge Base Article - Public

1433973 - CRJ - Optional Parameters Marked as Required by Asterisk

Symptom

Optional parameters should not show the asterisk mark (*) in the Crystal Report Viewer when running in a custom application.

With string parameters, the user must move the focus to each string parameter, before they can be submitted, even if they leave them blank.

Environment

Crystal Reports for Eclipse 2.0

Reproducing the Issue

  1. Create a command based report that has a string parameter and uses the LIKE filter:
    1. SELECT CustomerID, CustomerName FROM Customer WHERE CustomerName LIKE '%{?Parm_CustName}%'
  2. Using a web app using the CRJ, render the report.  When prompted for Parm_CustName, there's an asterisk (*) next to it indicating that it is a required parameter even though if you leave it blank, it'll still work correctly and all of the records will be returned.

Cause

Parameters that are used in the SQL command of a command based report are ALWAYS required and cannot be optional.  This is because the SQL is sent straight to the database and omitting a parameter could cause an error.

In the case of string parameters, this is enforced by requiring the user to confirm that an empty string is what's wanted.

Resolution

CRJ 2.6 (12.2.207.916) fixes the issue so that it is no longer required for the user to move the focus to the string parameter before submitting it.  The asterisk indicating that the field is required remains.  Although potentially confusing, the parameter is required by the SQL command and usability testing has shown that it's best for it to be there.

A workaround for CRJ 2.0 through 2.5 is to change the report so that each "optional" parameter has a default value.  In the case of string parameters, % could be used.

Keywords

crj crystal reports eclipse string empty blank null parameter required mandatory optional star asterisk asteriks asterix , KBA , BI-DEV-JAV , BI Software Development Kits (SDKs) - Java , Problem

Product

Crystal Reports, version for Eclipse 2.0