Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Passing variables to subreport and main (Another View)

Posted on 2002-03-13
2
473 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
ID: 6860176
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
ID: 6860183
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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 …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

839 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