1432184 - CR4E CRJ 2.x - Optional Parameter Now Mandatory

SAP Knowledge Base Article - Public

1432184 - CR4E CRJ 2.x - Optional Parameter Now Mandatory

Symptom

Previously, when using the JRC 1.0.x, when leaving a parameter blank, all of the records would be returned.

Now, when using the CRJ 2.x, when leaving that same parameter blank, it now returns none of the records.

Environment

Crystal Reports for Java (CRJ) 2.x
Crystal Reports for Eclipse (CR4E) 2.x

Reproducing the Issue

1. Create a command based report that has a string parameter and uses the LIKE filter:

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, leave it blank.

3. No records are returned.

Cause

The CRJ renders the SQL sent to the database differently than the JRC did.

Here is the difference in the SQL with a blank parameter:

JRC: ... LIKE '%%'
CRJ: ... LIKE '('')'

The JRC says, "match anything."
The CRJ says, "match nothing."

Resolution

Fix is currently (Jan. 2010) slated for CR4E SP6.

Workaround is to send in % for the parameter instead of leaving it blank.  This results in the SQL being:

... LIKE '%%%'

which works, although the parameter can no longer be left blank.

Keywords

crj jrc crystal reports java reporting component cr4e eclipse parameter blank sql mandatory required optional all none empty star asterisk asteriks asterix focus , KBA , BI-DEV-JAV , BI Software Development Kits (SDKs) - Java , Bug Filed

Product

Crystal Reports, version for Eclipse 2.0