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

CR 7: Variable Behaviour in Header and Footer Section

Status
Not open for further replies.

ferdisig

Technical User
Feb 14, 2001
7
0
0
US
Hi all,

I'm kind new in CR .
I try to make sum calculation (I've tried with running total and 3 formula in header,detail,footer section) , and put the result at report header section within the same variable.
But the result at header section is Zero ,although the same varible is used at formula at report footer produce the correct value.
The strange thing if I edited the report in preview mode (like move the object in the report), then the formula at report header section would refresh and produce the correct value (the same as formula at report footer section as I expected). The problem is this report will be deployed at web so user cann't edit the report design, so the user will always get Zero Value at formula in the header section .
Any solution or explanation will be greatly appreciated.

BTW : The report produce 3 pages, expected formula is put at report header section and the calculated formula is put at report footer section.

TIA
Ferdi Sig

 
ferdisig: Your formula sounds OK. IF you place it in the report header and do not refresh the data it will show zero. Refresh and it will show the total. You need to ensure that data is refreshed before your viewers get report David C. Monks
david.monks@chase-international.com
Accredited Seagate Enterprise Partner
 
Ferdisig:

To get the correct value to always show use the funtion:
whileprintingrecords;
as the first line of your formula code, be sure to include the ; to seperate it from the rest of the formula.

Note: you can always change the evaluation time of a formula as long as you are telling it to evaluate later then it normally will.

The reason you are getting a zero in the first formula is because it is evaluating before the values are calculating in the other formulas ie: details and report footer. Another fix for your problem would be to use the function:
evaluateafter(X);
X would be the name of the formula that calculates the value you are wanting to show in the report header formula.

Either of these should fix your problem.
Good Luck!
 
Ferdi,

Try starting the formula that accumulates the values with:

WhileReadingRecords;

And the Report Header formula with:

WhilePrintingRecords;


This should give you the result you want. However the running total my increment in an order different than the records print. The total might also pick up records that are subsequently removed from the report via Group Selection. Test it to make sure it does exactly what you want.

Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Thanks for all the tips. They're really helpfull.
I'll try them.

Regards
Ferdi Sig
 
Hi there

If you are wanting to not include the amounts that have been left out of the report with the group selection, you will need to use an if statement to exclude them in the totalling also. When they are removed with the group selection formula, they are still there, just not shown.

Here is an example of what I mean.

WhilePrintingRecords;
Numbervar X;
IF ONFIRSTRECORD = TRUE THEN
X := {@test} ELSE
IF (X < {@test} or X <= 0) THEN
X := {@test} ELSE
X;

hope this helps

E. McEvoy
Crystal Reports Consultant
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top