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!

variables resetting when more than 1 pg per entry... 2

Status
Not open for further replies.

cmpgeek

Technical User
Feb 11, 2003
282
US
thanks to Ido and synapsevampire i feel i have a firm handle on variables in general, but i noticed something when i tested my report this morning...

i have 2 sets of variables set up that add up the costs of items used during a case; the first set adds the items as they are divided out in item type categories; the second set totals those totals so that i have a grand total when all is said and done...

everything is fine as long as the case prints out all on one sheet; but that is a rare thing... a "typical" case will fill at least 2 sheets full of information. when the second page starts the variable placed in the group 1 header (group 1 = case number ) resets its total to 0 - which is how it is supposed to; the problem is, i dont want it to reset until a NEW case number is introduced.

i was guessing and entered:

if previous({case.casenum}) <> {case.casenum} then
whileprintingrecords;
numbervar HCPC:= 0;

had i stopped long enough to read that through carefully i would have known it wouldnt work... my first instinct was to change the <> to a = but i knew that was wrong as well...

if this was a one time only report i would just run it, export to excel, reformat everything to get rid of the wasted spaces and then graph it there; but this will be a consistently used report and i would never get anything else done that way...

is there anyway to set up the variable so that it only resets itself when the case number changes?

(i know i know - i am just never happy with what i have...)

thanks for everything...

[americanflag] ShannonLea [americanflag]

&quot;I keep hitting 'escape' but I'm still here...&quot;
 
Are you repeating the group header at the top of every page? I suspect so, because this is exactly what can happen here, the variable resets on every page instead of every group.

To keep this from happening, in your formula to reset the variable, add the following statement to the begining of the formula:

Not OnRepeatedGroupHeader

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
dgilsdorf@trianglepartners.com
 
Your formula should be this way

whileprintingrecords;
if previous({case.casenum}) <> {case.casenum} and
not inRepeatedGroupHeader then
numbervar HCPC:= 0;

Always place the &quot;WhilePrintingRecords&quot; first in the formula.



Jim Broadbent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top