Solved

Passing variables to subreport and main (Another View)

Posted on 2002-03-13
2
474 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 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

Title # Comments Views Activity
Select Cross-tab total 2 76
Crystal Reports 9 and Subreports 3 90
Crystal Report for VS2013 17 174
Help with a Crystal Report Formula - remove time 5 34
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…
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 …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

730 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