Solved

Need Subreports to Link to Main Report Date Fields

Posted on 2015-01-29
4
405 Views
Last Modified: 2015-01-30
I have a main report that I need to have 2 Parameter Date fields... However there are not Main Report Fields that have dates..  

I created 2 Shared Variables..
@SharedBegDate  
WhilePrintingRecords;
Shared DateVar  MRPBegDate:={?BegDate};""

and

@SharedEndDate
WhilePrintingRecords;
Shared DateVar  MRPEndDate:={?EndDate};""

These are both at the ReportHeader in the Main Report

In the GH2b I am calling the subreport...within the subreport I have the corresponding formulas @SharedBegDate, @SharedEndDate
shared DateVar  MRPBegDate;
and
Shared DateVar  MRPEndDate;   Respectively

The problem is that I am unsure how to show the detail of the subreport based on the these dates...The subreport has a datetime field that I am sure  I need to format.. but not sure how to do that while incorporating the variables.. Please help
0
Comment
Question by:Mikeyman_01
  • 2
4 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 40578065
Rather than using shared variables to link, just link the main report parameters to the subreport parameters.

The linking will create a selection formula which you will need to edit to change it from = to >= and <= for the range.

RIght click the subreport
Click CHANGE SUBREPORT LINK
Select the start parameter
Click the > to move to the top right panel
In the left dropdown select the subreport parameter (not the one suggested that begins with pm_)
Select the field in the subreport to filter on
Repeat for end parameter

Open the subreport
Display the SELECTION FILTER
Change the comparisons so you are using a range
{?startParam} <= {Datefield} and {?endparam} >= {Datefield}

mlmcc
0
 

Author Comment

by:Mikeyman_01
ID: 40578150
When I select the ?BegDate without the pm_.. the Select data in subreport based on field is greyed out..

I have added the same labeled parameter with identical data type to subreport...nothing allows me to link
0
 

Author Comment

by:Mikeyman_01
ID: 40578214
I got it...I was trying to use a Parameter Field from Main Report to a Parameter Field in SubReport...I changed the SubReport Parameter Field to a Formula Field Date({DateTime}) and it works.. Thanks
0
 
LVL 34

Expert Comment

by:James0628
ID: 40579466
When I select the ?BegDate without the pm_.. the Select data in subreport based on field is greyed out..
That's correct.  What you're doing there is linking the main report parameter (or field or whatever) to a subreport parameter that already exists, and when you do that, it's up to you to decide how the subreport uses that parameter.  So, the "Select data ..." option is greyed out.  You would need to go into the record selection formula in the subreport and use the parameter there (the last part of mlmcc's post).  IOW, you'd be adding the "Select data ..." part "manually", by editing the record selection formula.

 James
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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 …
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

828 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