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

Subreport Variable Problem

Status
Not open for further replies.

shelby55

Technical User
Jun 27, 2003
1,229
CA
Hi

I am using CR9 on a Windows XP/SP2 computer accessing an Access 2002 database. I'm just learning variables etc. so please bear with me.

I have a database with patient visit data. I have a one to many relationship with the Main table (one) and diagnoses (many).

The main report is based on the Main table and diagnoses are in a subreport linked by account # (unique). The main report is grouped by principle procedure and I want to summarize specific codes per principle procedure.

I created the formula in the subreport:
shared numbervar cancer := 0;
If {@CancerFlag} >= 1 then cancer:=cancer+1 else 0;
Note: The formula of @CancerFlag is looking at all diagnoses and picking out certain ones.

I place this formula in the subreport and in the main report I have a field where I call the variable:
whileprintingrecords;
shared numbervar cancer

This works in terms of no errors but the variable only shows 1. How can I summarize on the variable to tell me how many cases of cancer flag there are?

Note: ideally I want the variable of cancer to loop through all diagnoses per account number and only report +1 no matter how many times one of the valid cancer flag codes show up. However, I think I can solve that problem by using the summary of distinctcount versus sum (if I can actually sum on the variable in the first place)

All assistance greatly appreciated - thanks.

Shelby
 
Since you reset the variable to 0 each time you begin the formula, it makes sense that it returns at most a 1.

Place this formula in the Main report group header:

shared numbervar cancer := 0;

change th subreport formula to:

shared numbervar cancer;
If {@CancerFlag} >= 1 then
cancer:=cancer+1;

I'm guessing here as you didn't state WHERE the subreport is placed, which is critical.

I would think that you'd want to link on principal procedure, again, I'd need technical info to know.

-k
 
Hi sv

Sorry but you've confused me even further. What I want is a total per principle procedure of cancerflag diagnoses. How do I do this? Thanks.

Shelby
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top