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!

counting 2 different subreports

Status
Not open for further replies.

chrisgeek

Technical User
Oct 16, 2008
25
US
This is a convoluted solution to a temoprary issue so I don't want to use a stored procedure for it although I may have to.

I have 2 different sub reports the first which gives me how many people are in attendance and the second showing me the ones who are in a certain room. I used a shared variable in the first report

whileprintingrecords;
shared numbervar Place := maximum({location.placenumberid});

and in the second report I used

whileprintingrecords;
shared numbervar Room := maximum({location.roomnumberid})

this appears to reset fine in the main report and count fine but in the report footer I used the following formulas

whileprintingrecords;
shared numbervar Place;
shared numbervar cnt;


whileprintingrecords;
shared numbervar Room;
shared numbervar cnt;

They are both counting the same fields and I'm wondering how to go about counting these two sub reports seperately. I am thinking that I haven't declared the variables appropriately but I need a bit of help (or maybe a lot)

Any help you can provide I appreciate greatly.


 
You are almost there. I am assuming that you want to sum up the two values over the entire report. Here is how.

create a formula called "reset" with the following expression:

numbervar cnt1 := 0;
numbervar cnt2 := 0

In the section that calls the sub-reports create a fomula, "accum" with the following expression.
numbervar cnt1 := cnt1 + place;
numbervar cnt2 := cnt2 + room

Put that in a sub-section below where the sub-report is called.

Finally in the report footer show your values using two new formulas:

"summary_one"
numbervar cnt1;
cnt1

"summary_two"
numbervar cnt2;
cnt2

that should do it.

Howard Hammerman,
Crystal Training and Crystal Material
On-site classes and one-on-one coaching
Low-cost telephone/email support
FREE independent Crystal newsletter
howard@hammerman.com
800-783-2269
 
Thanks for the reply that may work and I'll be trying that in a second. I'm trying to understand the way this works especially as it comes to declaring the variable.

I created the reset formulas in GH_a which are

whileprintingrecords;
shared numbervar place := 0;

whileprintingrecords;
numbervar room:= 0;

and added formulas to the group footer

whileprintingrecords;
shared numbervar Place ;
shared numbervar cnt;
if Place <> 0 then
cnt := cnt + 1;


whileprintingrecords;
shared numbervar Room ;
shared numbervar cnt;
if Room <> 0 then
cnt := cnt + 1;

and report footer.

whileprintingrecords;
shared numbervar Place;
shared numbervar cnt;

whileprintingrecords;
shared numbervar Room;
shared numbervar cnt;

I was thinking that in this formula

whileprintingrecords;
shared numbervar Room := maximum({location.roomnumberid})
"Room" was being used to differentiate the two formulas (place being the other). Am I missing something? It appears that I am.

My goal is to have three values
value 1: Everyone invited
value 2: Everyone who came
Value 3: Everyone who made it into the room

Value 1 is just a running total from the main report
value 2: is subreport 1
and value 3 is subreport 2.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top