Board index » delphi » Problem With Shared Variable in Crystal Report !!

Problem With Shared Variable in Crystal Report !!


2003-11-19 02:28:02 AM
delphi114
I use statement like this :
WhilePrintingRecords;
shared currencyvar MyTotal := Sum({ITEM.PRICE})
to get a total from one subreport back to the main report. And this code is
do a good job.
But when i show the report, something like this happen :
Item Price
Ruler $4
Pencil $2
============
Total $6
No Data Show
============
Total $6
If my subreport will show 2 detail with the second detail got no record, but
the value from total could not set to zero again.
So how to init this shared variable become zero for the first time before
enter into calculation ??
Thanx
Ronny Widjaja
 
 

Re:Problem With Shared Variable in Crystal Report !!

Ronny Widjaja writes:
Quote
I use statement like this :

WhilePrintingRecords;
shared currencyvar MyTotal := Sum({ITEM.PRICE})

So how to init this shared variable become zero for the first
time before enter into calculation ??
You need to add a formula in the group header or wherever is before
the subreport to call
shared currencyvar MyTotal := 0;
That will reset it, then shell to the sub report to increment it,
then display it, then reset it...
-Brion