Chart Expression for varchar ordering on X axix

  • Hi, I have a chart where the x axis are grade scores, however, they are varchars and I think this is why I can't sort them in order properly. It comes out: 100, 60, 85, 92. I can't get the 100 to go after the 92. Is there an expression to format this correctly? Thanks

  • On the "Chart Data" context menu that appears when you select on the chart, right-click the value under "Category Groups" (by default "= (Details)"),

    Select "Category Group Properties"

    Switch to the "Sorting" tab and click "Add"

    Click "fx" to enter an expression, and set the expression to the below, where SCOREFIELD is your field name.

    =Int16.Parse(Fields!SCOREFIELD.Value)

    This should make your report convert the VARCHAR values to integer before sorting them. Does this help?

    Also, I'm assuming you can't CAST to INT and do any sanitation in the SQL query?

  • You can also convert into Val which is auto conversion into the numeric value. =Val(Fields!SCOREFIELD.Value)

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply