How to dynamically change line chart in Crystal Reports for .net 2003

ocortes
ocortes used Ask the Experts™
on
Hello,
I have a Crystal Report that contains a line chart. It works good but I want to be able to dynamically change the Data, for example I want to chage the option "On Change of" that at this moment is date for a differente field. Also I want to be able to change the "Show value(s)" summary operation from sum to avg from my asp.net page using C#. I wan to know if this is possible passing parameters and some kind of formulas but I haven't found anything on the Internet so far. Any help will be appreciate it.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Kyle AbrahamsSenior .Net Developer

Commented:
I would recommend coding your data in a stored procedure using parameters

In your ASP . . . any time there is a change to the params, recall the stored proc and the data will update automatically.

Sum to Avg is just another parameter.

Say you pass a 0 for sum
make a conditional supress formula in crystal for the sum RT when that value <> 0
do the same for Avg where the value <> 1 .  . . you can overlay them in the same position, but you'll only ever show the one of them.

Author

Commented:
Hi,
Actually the report is generated by a stored procedure with the parameters, customer, date1 and date2 the report just shows loads of product picked up with their test result in the range of dates so we have the following columns:
Date
Ticket
Lbs
Test1
Test2
I am just creating a line chart showing each load using "in the change of" Ticket and the max "summary operation". This gives me a point in the chart for every load. But if the customer has to many loads the chart gets too many points that it is impossible to read, so I want to group by date and set "in the change of" Date and show the average as "summary function". I can pass parameters to the report without problems but then I don't know how create the formulas to manipulate the chart or what fiields to change. Could you help me with that?
Mike McCrackenSenior Consultant
Most Valuable Expert 2011
Top Expert 2013
Commented:
I don't think you can manipulate the report that way through code.

WHere is the chart in the report?  which section?

One way you could approach this would be to add a group to the report that groups on date by a specified period.
Put the chart in the group header or footer and the data will be limited to the group period.
You could control visibility through a parameter or by counting the records returned.

mlmcc
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Top Expert 2009
Commented:
Two charts in two sections. One a summary of each data point, one an average of points by grouping.
Use a parameter to suppress the section containing the chart you don't want.

You could even suppress the section using
count({ticket}) > XXX
and
count({ticket}) <=XXX

in the relevant sections.

Author

Commented:
Thank you very much for both options. Right now the report is on the Report Header but I can move it and I also like the idea of two charts in two sections.  I will try them and let you know.
Regards
Top Expert 2009

Commented:
Remember you can click on the report header and 'insert section below' to get two report header sections.

The only place it doesn't work to do this is page footer. (Page, not report)
Mike McCrackenSenior Consultant
Most Valuable Expert 2011
Top Expert 2013

Commented:
It works in CR XI to get multiple Page Footers.  You click in the left margin not the section itself.

mlmcc
Top Expert 2009

Commented:
Yes, but the space is always reserved for (either all, or the largest) page footer section,
so doing this where one or the other is always 'off' can wind up getting you large areas of blank space.

Author

Commented:
Thank you very much, I went with the idea of two charts in two sections but I test the other idea and seams to work to.
Best Regards

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial