SAP Knowledge Base Article - Public

2042551 - The following characters are reserved for internal use only in Crystal Reports Designer formula names - ‘@’,’?’,’{‘,’}’

Symptom

Existing Report with {} in the formula name causes Crystal Reports Designer to be slow to open the report

In a CR for VS Windows .NET app it may fail to load report and/or it may generate an error - error in formula

Environment

  • Crystal Reports Designer 2008 and higher ( Note: this likely was always allowed but may have generated various errors when attempting to use them)
  • Crystal Reports For Visual Studio

Reproducing the Issue

Open your report in CR Designer, notice formula name has a field reference in the name

  • Example {abc}

Using CR for VS .NET SDK the following will return zero formula count, if it's the only one:

  • MessageBox.Show (rptClientDoc.DataDefController.DataDefinition.FormulaFields.Count.ToString());

If more than one formula then to verify if the formula is valid use the following:

  • String FormulaMessage = rptClientDoc.DataDefController.FormulaFieldController.Check(resultField);
    if (FormulaMessage != null)
    {
        btnReportObjects.Text += FormulaMessage.ToString() + "\n";
    }

Cause

These characters are used internally for labeling various Report Objects and should not be used when creating those objects, formula.

CR Designer allowed them to be created but would often cause issues when previewing or using the in a .NET Windows application

NOTE: most software venders typically use any character on the Shift Top row characters of your keyboard as reserved characters. Avoid using any of them. Crystal Reports Designer will aloow them but the SDK's will not

 

Resolution

The following Adapt was created to not allow users to use those characters when designing reports - ADAPT01728520

The updated Crystal Reports Designer will begin with CR 2011 SP 11 and Crystal Reports for Visual Studio embedded Designer in SP 11 and all future releases.

Note: to update the reports you will need to open each one and "fix" it manually

To catch the inner exception use the following in a Try/Catch block when opening the report:

try
{
    rpt.Load(rptName.ToString(), OpenReportMethod.OpenReportByTempCopy);
}
catch (Exception ex)
{
    if (ex.Message.ToString() == "Load report failed.")
    {
        MessageBox.Show("ERROR: Load report failed: " + ex.InnerException.Message.ToString());
    }
}

Keywords

‘@’,’?’,’{‘,’}’, Crystal Reports, Crystal Reports for Visual Studio, error in formula, reserved characters '{', '}', '@', '?', , reserved characters '{', '}', '@', '?' cannot be used in formula name , KBA , BI-RA-CR-SDK , SDK related, including Java/.NET etc. , BI-RA-CR , Crystal Reports designer or BusinessViews Manager , Problem

Product

Crystal Reports 2008 V0 ; Crystal Reports 2008 V1 ; SAP Crystal Reports 10.0 ; SAP Crystal Reports 2011 ; SAP Crystal Reports 2013 ; SAP Crystal Reports XI ; SAP Crystal Reports XI R2 ; SAP Crystal Reports, developer version for Microsoft Visual Studio ; SAP Crystal Reports, version for Visual Studio .NET 2005 ; SAP Crystal Reports, version for Visual Studio .NET 2008 ; SAP Crystal Reports, version for Visual Studio .NET 9.1