Solved

Passing variables to subreport and main (Another View)

Posted on 2002-03-13
2
469 Views
Last Modified: 2008-03-04
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
0
Comment
Question by:zerobro
2 Comments
 
LVL 4

Accepted Solution

by:
jrmn earned 100 total points
Comment Utility
Hi zerobro

Hmmmmmm, the problem of what you are doing sounds like you
should be able to achieve the same result without dealing with the subreport and a shared variable at all, but
assuming you have your reasons and more, the problem you are running into is due to evaluation time.
All variables in a section are evaluated BEFORE the subreports on that section get processed.  
You could insert a secondary detail section below the detail section for the subreport and place the shared variable there.
I should know better since I have encountered this problem before :-)

Goodluck
jrmn
0
 

Author Comment

by:zerobro
Comment Utility
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
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now