Symptom
In a Windows.Form .NET viewer app displaying a crosstab report using Condition formula set to crNoColor evaluates differently from CR Designer.
In CR Designer the data is shown.
In the .NET application no data is shown, evaluates to True.
Why is there a difference?
Environment
- Crystal Reports Designer
- Crystal Reports for Visual Studio .NET
Reproducing the Issue
Example of a Crosstab field formating formula:
// This conditional formatting formula must return one of the following Color Constants:
//
// Color (red, green, blue)
// crBlack
// crMaroon
// crGreen
// crOlive
// crNavy
// crPurple
// crTeal
// crSilver
// crRed
// crLime
// crYellow
// crBlue
// crFuchsia
// crAqua
// crWhite
// crNoColor
//
If "combined_vmi_vendor_activity.VMI_TYPE"<>"BEG_BAL" then crNoColor
Cause
The text color defined in CDC is used type COLORREF. COLORREF is a RGB value from (0, 0, 0) to (255, 255, 255) to indicate different colors.
But there is no value to indicate a transparent color, limitation of CDC function.
This function works well in dotnet because text color is defined as type of ARGB in the dotnet system. ARGB has an A value to indicate whether this text is transparent. So whatever the value of the text color, if A value is set to 0, text shows transparent in dotnet.
Resolution
The only way to set the text to no color In Crystal Reports Designer is to set the RGB of the text color to the same as the RGB of the background color.
For example, right click on the field in the Crosstab and select Format Field...
- Click on the Font tab, notice the color is typically set to Black
- Click the X-2 button to add a condition formula and set the color to the same as the color selected above:
If "combined_vmi_vendor_activity.VMI_TYPE"<>"BEG_BAL" then crBlack
Keywords
crNoColor, crosstab, conditional format formula, cr for .net, windows form viewer, crystal reports , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , BI-DEV-NET-SDK , .NET SDK / COM SDK , Problem