?
Solved

Passing variables to subreport and main (Another View)

Posted on 2002-03-13
2
Medium Priority
?
480 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
[X]
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
2 Comments
 
LVL 4

Accepted Solution

by:
jrmn earned 400 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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

650 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