SAP Knowledge Base Article - Public

1841478 - Runtime Error: A number is required here... When viewing a Crystal Report from a Visual Studio application

Symptom

  • Report with a formula runs as expected in the SAP Crystal Reports Designer
  • Same report also runs with no error in a Visual Studio application - on the development system
  • Same report runs without error on most deployed systems
  • On some deployed systems, the report throws the the error:

 

A number is required here... <formula>

 

 

Environment

  • SAP Crystal Reports, developer version for Microsoft Visual Studio
  • Microsoft Visual Studio

Cause

  • The data type is different than what the report is expecting
  • This is often, thought not exclusively the case when using XML as a datasource:

 

    • If and XSD specification is not provided at runtime, all fields are converted to string

Resolution

  • Ensure that field types match what the report is expecting (what it was designed against)
  • Create a formula that will work irrespective of the field being numeric or string:
    • Nest the database field in a function:

 

val ( replace (Totext ( {myDB.field}  ) , ','  , ''  ))

  • The above formula will not work with currency fields - use second Replace() function to remove the currency sign, commas, etc.

 

 

Keywords

deployed run time CRVS CR4VS 2010 2012 VS , KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , Problem

Product

Crystal Reports 2008 V1 ; 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