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

Reseting Variable Values Prior To Next Entry/Group 2

Status
Not open for further replies.

glthornton

Programmer
Oct 19, 2005
108
US
Hi Everyone,

CR XI
SQL DB

I'm creating a report that has 2 subreports embedded in it. Both subreports are passing weight values up to the main report (using parameter passing) and then the main report is performing some additional calculations. Well, my calculations are working great when I have 2 values to work with, but when one is missing the values contained in the variable names are getting passed on to the next entry and I cannot have that. I need to zero out the variable prior to each entry. Can someone tell me how I do this?

On my report I have a "Details a" and "Details b" line. My "Details a" line has "overlay following sections" enabled because my calculation field is located in the "Details b" section because the data is being passed up from subreports.

Thank you,
glthornton
 
You need to have a reset formula

@reset
Whileprintingrecords;

shared numbervar whatever:=0;

Place this formula in an appropriate location to rest to zero as required.

Ian
 
The appropriate location being the group header of the group you wish to accumulate.

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"A fine is a tax for doing wrong. A tax is a fine for doing well.
" - unknown
 
Thanks Ian and dg!!

I got it to work perfectly with your assistance. This is what I did:

1. Create a reset formula function(ResetVariables) containing:
Whileprintingrecords;
shared NumberVar LstWght:=0;
shared NumberVar SixMonWght:=0;

2. Dragged this new formula down into the "Details b" area to the right of my calculation formula field. I also supressed this particular field as well even though there is nothing being displayed.

Now, if my Main Report was grouped by the patient then I would have put my reset formula in the group header area.

One thing I learned from this particular event is that I now know that when working with Crystal Reports that the report reads from left to right and top down.

Thanks again for all your help!!
glthornton
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top