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!

"Static" graph? 1

Status
Not open for further replies.

LV

Programmer
Nov 1, 2000
1,184
US
Is there any way to display a "static" chart, representing just a fixed value (not one value on change of another, or for all records or for each record)?

Here is what's going on:
I have two formulas, placed in detail(suppressed)section.
They accumulating two totals based on {@EndPeriod} formula value(passed to the report from ASP app), difference of which should be displayed in the report(page) footer.

Here is the formulas in detail section:
first:
{@SalesTotal}

whileprintingrecords;
currencyvar cSalesTotal;

if {@EndPeriod} = 1 then
cSalesTotal:= cSalesTotal + {Glcoa.SalesAmount0} +{Glcoa.SalesAmount1}
else if {@EndPeriod} = 2 then
cSalesTotal:= cSalesTotal + {Glcoa.SalesAmount0} + {Glcoa.SalesAmount1} + {Glcoa.SalesAmount2}
else if {@EndPeriod} = 3 then
cSalesTotal:= cSalesTotal + {Glcoa.SalesAmount0} + {Glcoa.SalesAmount1} + {Glcoa.SalesAmount2}+ {Glcoa.SalesAmount3};

cSalesTotal;

second formula:
{@ReturnsTotal}

whileprintingrecords;
currencyvar cReturnsTotal;

if {@EndPeriod} = 1 then
cReturnsTotal:= cReturnsTotal + {Glcoa.ReturnAmount0} + {Glcoa.ReturnAmount1}
else if {@EndPeriod} = 2 then
cReturnsTotal:= cReturnsTotal + {Glcoa.ReturnAmount0} + {Glcoa.ReturnAmount1} + {Glcoa.ReturnAmount2}
else if {@EndPeriod} = 3 then
cReturnsTotal:= cReturnsTotal + {Glcoa.ReturnAmount0} + {Glcoa.ReturnAmount1} + {Glcoa.ReturnAmount2}+ {Glcoa.ReturnAmount3};

cReturnsTotal;

Formula in the footer:
{@NetSales}

whileprintingrecords;
currencyvar cSalesTotal;
currencyvar cReturnsTotal;

cSalesTotal - cReturnsTotal;

The number is displayed correctly.
What I need to do now, is to represent this value in a chart, just a single bar showing value of {@NetSales}.
Because there is no dynamic, I was trying to work around it setting in the Chart Expert's "Data" tab: Show {@NetSales} on change of {@NetSales}.
Then in the "Axes" tab I adjusted the min and max values for Data axis so {@NetSales} value falls in the range.
So far I have a problem doing this, the graph sees the value of {@NetSales} as zero, althiugh it's displayed correctly in the report.
What's interesting, if I just hardcode some value in {@NetSales} formula, then it works.

Any ideas?
Thanks in advance.

 
Ken,
Thanks for the response.
I'm using version 8 Developer.
I think, it's just a matter of timing;
the graph starts to create before the formula is fully evaluated.
 
I think that you can do this process without variables, which will make it fit better with CR processing. Use a conditional formula and do regular Grand Totals of the column.

For instanceuse this formula:

if {@EndPeriod} = 1
then Glcoa.SalesAmount0}+{Glcoa.SalesAmount1}
else
if {@EndPeriod} = 2
then {Glcoa.SalesAmount0}+{Glcoa.SalesAmount1} + {Glcoa.SalesAmount2}
else
if {@EndPeriod} = 3 then {Glcoa.SalesAmount0} + {Glcoa.SalesAmount1} + Glcoa.SalesAmount2}+
{Glcoa.SalesAmount3}

Then create a grand total of this formula.
Do the same with the other formula.
Create a third formula (no variables) that takes the difference between the two grand totals. Now, use an "advanced chart" which doesn't need grouping to graph the value of the last formula. Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Ken: Thanks for the help.
I found a work around it, which is creating a subreport and passing those variables as "shared" to the subreport.
The subreport has a graph based on formulas, containing "shared" vriables.
Your way seems to be more effective though so I'll work on it and let you know how it worked.
Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top