Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Chart sort order not working with a function of a function

Status
Not open for further replies.

ZacharyR

IS-IT--Management
Feb 20, 2009
28
CA
Hi,

I have a bunch of dates in this format MM/DD/YYYY. I created a function called @DateMonth and used 'Month (x)' to get the month only - the values are returned as a number, that is 1 is January, 2 is February, etc. When I chart this out on the X axis, the months appear in perfect ascending order - 1, 2, 3, 4, and so on.

But I need the actual month name, instead of the numeric equivalent. So I created a new function called @MonthName and used the 'MonthName (x)' function to convert the numeric value to the actual month text.

It looks like this:
Code:
MonthName ({@DateMonth})

But now when I chart this out using the @MonthName function on the X axis, the order of the months is random - even though I specifically say to sort in 'ascending order'.

CR is ignoring my sort request when I use @MonthName - which is essentially a function of a function.

Is there a workaround for this?

thanks!
 
My guess is that the months are NOT in random order. If you look closely I bet they are in ascending ALPHABETICAL order. In other words April is first because it starts with A and September is probably last. These are now words rather than dates so they are sorted as such.

What you need is to use Specified Order instead of Ascending order. Then you select the months in the correct order.

Also, if you have up to 12 months of data in the report you could just use the date field itself as the chart field, and in the chart options select "For each month". That should give you the month names in the correct order.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guides to Formulas, Parameters, Subreports, Cross-tabs, VB, Tips and Tricks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top