Symptom
- Numeric values truncated.
- When viewing a PDF document, some numeric values are truncated.
- Numeric values larger than the size of the object defined on the report, displays the characters ##### in Crystal Reports.
- When a report is exported to PDF format where the numeric values is displaying as ####, are displayed instead in the PDF document, but are truncated.
Environment
- SAP Crystal Reports 2008
- SAP Crystal Reports 2011
- SAP Crystal Reports 2013
- SAP Crystal Reports 2016
Reproducing the Issue
- Create a report off any data source that contains numeric values.
- Insert a database fields or formula fields that returns a number on the report.
- Format the object to display the character: “#” when the content of the object is larger than the object size. ( This is the formatting by default )
- Right click on the object, and select: “Format Field…”
- In the “Format Editor” window, under the tab: “Number”, click on the “Customize” button
- Ensure the option: “Allow Field Clipping” is uncheck, then click “OK”
- Back the “Format Editor” window, click on “OK” to accept the change.
- Preview the report.
- Resize the numeric field to ensure that some of the value display the characters “####” as the content is larger than the size of the numeric field.
- Export the report to PDF format.
- Open the exported document in PDF format, and notice where we would expect to see the characters ####, it displays a truncated number.
- For example, if we have the following values:
- 123
- 4567
- 89
- And on the report, if the size of the database field object is smaller than what can be displayed, and we setup the formatting of the object to display the character: “#” instead of truncating the object, it will displays on the report like:
- 123
- ####
- 89
- But when exporting to PDF it looks like:
- 123
- 567
- 89
- As you can see the second number not longer displays ####, but it displays the truncated value of the number.
Cause
- This behavior has been confirmed to be by design. ( Reference ADAPT01605160 )
Resolution
- To avoid truncating numeric values when exporting to PDF format, you can apply one of the following workaround:
- Resize the numeric field on the report to be larger than the largest numeric value; or
- Create a formula that convert the numeric values to text to display the characters "####", if the number of characters is less than the maximum number of characters limit. Then insert the formula field on the report.
For example, if we set the limit to 10 characters, the formula may look like:
- Resize the numeric field on the report to be larger than the largest numeric value; or
Local NumberVar MyNumber := ToNumber( <INSERT YOUR NUMERIC FIELD HERE> );
Local NumberVar Limit := 10;
Local StringVar MyNumberTxt := ToText(MyNumber);
If Length(MyNumberTxt) > Limit Then
ReplicateString("#",Limit)
Else
MyNumberTxt
Keywords
CR , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , Bug Filed
Product
Crystal Reports 2008 V0 ; Crystal Reports 2008 V1 ; SAP Crystal Reports 2011 ; SAP Crystal Reports 2013 ; SAP Crystal Reports 2016 ; SAP Crystal Reports XI R2