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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Field is sorted, but chart of does not show the sorted data! 1

Status
Not open for further replies.

ZacharyR

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

quick question.....I have built a simple report....one of the fields shows dates, so I naturally set it to sort and display in ascending order....works like a charm.

The problem is the chart that is showing the same data is NOT reflecting this sorting.....the date (X) axis is just randomly placing the points....i would like it to go from oldest to newest across the X-axis.

Any idea why the field sorts as it should in the details listing, but in the chart, the date fields are still randomly placed?

The only thing I can think of is I created the graph BEFORE I set the sort order for the date field.

many thanks!

Zach
 
Charts don't look at sorts at all. But they do look at groups, so if you can create a group instead of a sort, then you might be able to create a Group chart that does what you want.

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
 
Is the date field a string field? Or a formula? It may be sorting incorrectly because it is not treating it as a date.

-LB
 
Are you telling me I cannot do something as simple as telling Crystal to chart the values, from oldest to newest? ...that Crystal will just chart the values as it receives them from the data server? (my data is on Oracle). If I can sort a field to display in ascending order, why the heck can't I tell the chart to do the same thing!?

I don't want the chart to shows groups. I just want a simple chart that shows individual values for all the years, in ascending order.

I very surprised this is not possible.


 
lbass: the date field is not a string field...it says "DateTime" next to it under the field explorer
 
OK....for the time being I have gone ahead with using groups.

-I created a grouping based on each year (ie. one group per year)

-I then create a summary on each group showing the average reading (i'm dealing with water sample data) value for said year

The resulting chart I created easily shows the yearly groups, with the average value....the chart is chronologically correct.

BUT, again...this is NOT what I want...I just want a chart that shows all values across the X axis, starting from oldest to newest.....no groupings wanted, whatsoever.

Can it be done?

(thanks for the help so far!)

Zach
 
How exactly is the chart set up? If you use the date field as the 'On change of' field and while it is highlighted click on 'Order', you should see it in ascending order.

So you didn't create a formula based on month and year and you don't have a higher order group?

-LB
 
I think i've found a workaround....it's amazing it works:

1. Create a grouping for the date field, and in the 'Change Group Options' dialog box, set 'The section will be printed' to "for each day"

2. Create a summary for the grouping...choose to do an average of the group's data values

* Since each group only refers to a single day, and each day only has one value, an average returns the actual value (that is, averages can only be calculated on more than 1 value)

I can then set my chart data type to 'Group', whereby I set the 'on change of' to the date field, and the 'show' to the summary (average) for the groups' data values. That way, each data point on the chart refers to each sample, and the value is the average (which is really the actual value!)


SO...for now, this works, but really....it's hard to understand why this simple functionality is not included in this software...that is, if I can sort a fields in the details listing, why can't I sort that field in the SAME way when i make a simple??

Zach
 
lbass: good stuf!!

I had it set up to show the data 'for each record' ...the 'order' button was not available to me...

I changed it to 'On change of' and the order button was now available.....and the chart shows up in proper chronological order!!!

But that begs the question....what's the difference between using 'for each record' and 'on change of' in this case...

All I wanted to do was show the sample values for each date, hence why i chose "for each record" ...in my mind it meant 'for each sample record/date, show the sample value'

thanks for the help

Zach
 
I think "for each record" means exactly that--show a value for each row, as opposed to for each date (which might be associated with more than one row).

-LB
 
but still, if you were to choose 'for each record' why would you not be able to sort the values before they're placed on the chart?

thanks for the help though!


 
If you change the sort in the main report, the chart should follow that sort in the chart. If you have any groups though, groups have priority for sorting, and then your chart would be ordered first by the group field, and then by the date.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top