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

Sub Reports not passing values

Status
Not open for further replies.

terenceb

Programmer
Jun 10, 2003
77
US
Hi,

I am running Crystal 8.5 pulling data from Cache database on Win XP PC.

I have a sub report that calculates the balance for an individual client. The subreport works fine and calculates the balances all correctly, If i run them one at time. If try to run the report and allow it to calculate balances for all clients using this parameter.

IIF ({?patid} = "ALL", {client_demographics.PATID} = {client_demographics.PATID}, {client_demographics.PATID} = {?patid});

I get the correct value for the first client and the rest are zero.
I am initializing my variables in the group header for client demographics PATID(patient id. this is what I initialize.

whileprintingrecords;

shared numbervar Balance:=0;
shared numbervar Charges:=0;
shared numbervar Payments:=0;


That in itself is a whole different problem. Since the report does produce the correct value if I run the report one PATID at time. I felt that I could insert this report into my main report run the subreport using the PATID from the main report. Doing this I only get zero for every client.

I placed the subreport in the Group header for PATID and a variable in the detail section to display the value.

any ideas or leads will be appriciated.
 
Dear Terenceb,

What happens if you rewrite your selection criteria as follows:

(
If {?patid} <> 'ALL'
then {client_demographics.PATID} = {?patid}
else
if {?patid} = 'ALL'
then true
)

regards,

ro

Rosemary Lieberman
rosemary-at-microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.

You will get answers more quickly if you read this before posting: faq149-3762
 
I don't believe I have provided enough information. The report that calculates the Balance has two subreports running within it. One subreport totals the payments and the other totals the charges. The values come through perfect if I run them by PATID one at a time. I am not sure if the two subreprots are the problem.


Yes,the formula did work. However when I place the report in my main report it freezes.
 
Wait ... where is that selection criteria?

I am assuming the selection criteria is in the main report.

The report is grouped by Patient ID and the subreport(s) are linked to patient id.

Maybe you need to define the layout of your report.

my formula for the selection criteria in the main report, shouldn't make the report freeze.

regards,

ro

Rosemary Lieberman
rosemary-at-microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.

You will get answers more quickly if you read this before posting: faq149-3762
 
Okay I am still seeking help with this issue. I had a vacation I could take and I did. I am using two subreports. One calculates the Total payments the other the total charges. I link them as follows In the Available field I select Clientdemo.PATID, in the subreport parameter field I choose the parameter I created in my subreport ChargePatid and when I link the second report I use PaymentPatid. I place both subreports in the Group Header for clientdemo.PATID. I have a formula field for my varible declarations. Place in the Group Header 1b.
shared numbervar Balance;
shared numbervar Charges;
shared numbervar Payments;


If I run the subreports seperately they run correctly for every PATID or individual. Please help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top