Symptom
- Sort order of the x-axis labels on the chart change when inserting a number field converted to text
- How to remove decimal numbers from the x-axis label and also make sure that the sort order of the x-axis doesn’t change?
Environment
- Crystal Reports XI R2 (All Patch levels)
- Crystal Reports 2008 (All Patch levels)
Reproducing the Issue
- Create a Crystal Report against the Xtreme Sample Database
- Insert a chart on the Report Header (Insert->Chart)
- Right click the chart and go to ‘Chart Expert’
- In the ‘Data’ tab select ‘Orders.Order Amount’ and move it to the ‘On Change of’ area
- Select ‘Customer.Customer ID’ and move it to the ‘Show value(s)’ area
- Click ‘Ok’ and refresh the report
- Observe that the x-axis of the chart displays the Order Amounts in sorted order, however we want to remove the decimal places and also make sure that the sort order doesn’t change
Cause
This is ‘By design’. Crystal Reports will display the database field in any of the axis’ ‘as it is’
Resolution
The following work around helps in overcoming this situation
totext({Orders.Order Amount},0);
Keywords
x-axis, sort order , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , Problem