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

chart displaying off one record from main report

Status
Not open for further replies.

remata

Technical User
Sep 18, 2011
7
US
thread149-1589108
I have shared variable in sub report and called that in to main report.
main report has two groups, 1) clinic_id and 2) location_id.
sub report also has same thing.
I have my sub report in location_id group footer A and shared variable in location_id group footer B.
Chart is in location_id group footer C.
shared variable shows right results: for example i have two locations:
location shared variable
11 200
22 300

But in the chart shows 0's for location 11 and 200 for location 22.
which means no matter what it displays 0's for the first location. this is very odd behavior.
any one can help on this please?

 
So, did you link the sub to the main report and both the clinic id and the location id?

Please also identify your CR version and explain specifically how you set up the chart.

-LB
 
Yes I did link on both fields.
I am using Crystal Report 2008 version.
I have following calc in sub report:
MTD sub:
shared numbervar Y;
Y:= sum({daily_summary_fact.actual_revenue},{daily_summary_fact.location_id});
MTD main:
Main report formula:
shared numbervar Y;

I'm trying to place the MTD main in the chart. first graph displays 0 as amount and next graph displays amount even though i have amounts for both the graphs. I mean both locations.



 
And how is the chart set up (on change of field, summary field)? Please show the content of all formulas.

-LB
 
on change of field : Types (M,Q,Y - these are values in the Types feild)

Summary field is: MTD main -(sum({daily_summary_fact.actual_revenue},daily_summary_fact.location_id})
Don't summarize checked in.
 
Are you saying that MTD Main (your shared variable referenced in the main report) is appearing on the field list for charting? I don't have access to CR 2008 where I am, but shared variables aren't available for charting in XI.

-LB
 
remata,

there is a way to do this, but I think if you want to chart by type, the summary is the same for all types. If you want to see variation by types, you should be adding a group on types and then using a formula like this:

MTD main -(sum({daily_summary_fact.actual_revenue},{table.type})

You probably need to do the same in the subreport, and link on type, but leave the sub in GF2, so you can chart the variation of type within location.

To make the above formula accessible in the chart expert, first add a formula like this as the chart expert summary:

sum({daily_summary_fact.actual_revenue},{table.type})

After you run the report, go back and change the formula to:

shared numbervar y;
y-sum({daily_summary_fact.actual_revenue},{table.type})

-LB
 
If I do that I will get print time value error message on chart.
but what I did was to make it work in sub report, declared my shared variable like below
whileprintingrecords;
shared numbervar s_mtd;
global numbervar MTD sub:=
sum({daily_summary_fact.actual_revenue},daily_summary_fact.location_id

 
sorry..

whileprintingrecords;
shared numbervar MTD sub;
global numbervar sub:=
sum({daily_summary_fact.actual_revenue},daily_summary_fact.location_MTD sub:=sub;
 
I forgot to tell u one more thing is that in the main report i have created a dummy formula to call the sub report shared variable. and then created another local formula to call the dummy formula. now chart expert shows the formula. this is work around to see the formula in the chart.

Help me understand. I'm able to see the results in cross tab and GF without any issues for each location with the variations. the only issue i have is first location graph shows 0's and second location graph shows first graph values.

I'm reading the below link and i don't quite understand the logic what they are trying to do
 
The problem is that the chart(whilereadingrecords--even though you have fooled into accepting a whileprintingrecords value) is processed before the subreport(whileprintingrecords), which is causing the delayed values. So another approach would be to follow the steps in the SAP technical paper, but you would need to pass values from your main report into the subreport and do the calculation and chart in the subreport.

I have used this technical paper for charting before, so if you try it and run into problems with any of the steps, I may be able to help you, but I don't want to have to explain all the steps in advance, as it is quite complex.

If there is some other way you can bring the subreport values into the report, that might be easier.

-LB
 
Thank you for the suggestions.

I found very stupid solution is that I had to make main report copy and bring that same report as a sub report in to the main report Group Header (Location_id).

I was doing this just to play around with another formula and found that this solution.

So weird chart techniques in crystal reports.

Million dollar question is, the formulas work in group footers/group headers and even in cross tabs. Why can't they work same in chart? Cross tab and Chart behavior should be same but not in Crystal.




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top