Link to home
Start Free TrialLog in
Avatar of zerobro
zerobro

asked on

Passing variables to subreport and main (Another View)

Hi Guys,

I have a subreport. This subreport contain one and only table named PATIENT.
I created a formula which contains the following code lines:

WhilePrintingRecords;
Shared NumberVar Pkey;
Pkey:={PATIENT.PATIENTKEY};

Then I put this report on the subreport's detail section

The main report contains one table named SCHEDULE
The subreport is connected to the main report via PATIENT.PATIENTKEY = SCHEDULE.PATIENTKEY.

On the main report, I created a formula to hold the shared variable on my subreport
The formula code is like this:

WhilePrintingRecords;
Shared NumberVar Pkey;
Pkey;

Then I put this formula on the main report's detail section


For some valid reason, I just need to have this PATIENT table as a subreport to support my other functions.

As a test sample, I setup 3 schedules/appointments for 3 diff'rent patients.

Upon running the report, the subreport generates 3 patient keys namely 3, 5 and 6. It displays perfectly fine but the formula I crated to hold the shared variable, generates the values 0, 3 and 5

I don't quite understand why I got a zero(0) value which is sort of a replacement of patientkey 6.

What will I do so that I can get the same values on the subreport? I want to get 3,5 and 6 not 0,3 and 5. Is there anything wrong with my formula?

MS SQL Server 7.0 and crystal report 8.5
I installed my cr8.5 without uninstalling my cr7. Will this cause any problem?


Please, help badly needed,

zerobro
ASKER CERTIFIED SOLUTION
Avatar of jrmn
jrmn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of zerobro
zerobro

ASKER

Hi jrmn

Yup, you are right. Just a minute ago, I figured out the same thing you suggested here. Yup, what you said is the one causing my problem.
Anyways, thanks for the info. It made my findings more concrete.

Thanks,
zero