Solved

Crystal Reports Record Selection Formula Based on Two Date Fields

Posted on 2010-08-19
4
921 Views
Last Modified: 2012-05-10
Hello Experts,

I am working on a report (Crystal Reports version 11), that uses a global date parameter to link multiple subreports.  When I run the report I enter a single date range and each subreport has the following in its record selection:
{MManpower.M_tTime} >= {?Pm-@Begin Range} and
{MManpower.M_tTime} <= {?Pm-@End Range}

My quandary is that I am trying to add a second date condition in the record selection using the following syntax:
(({MManpower.M_tTime} >= {?Pm-@Begin Range} and
{MManpower.M_tTime} <= {?Pm-@End Range})
or
({IIncident.I_tTimeTransmit} >= {?Pm-@Begin Range} and
{IIncident.I_tTimeTransmit} <= {?Pm-@End Range}))

But, I am not getting records back that are based on the second table.date field - I am only getting records back based on the first table.field.  Is this because the subreport link in the primary report is based on only the first table.field?  If so, is there a way to link the global date parameter in the subreport links to more than one table.field?  Or, is my syntax incorrect? Or do I need a different work-around?

Thank you for your help with this.
~Chopp
0
Comment
Question by:Chopp
4 Comments
 
LVL 8

Accepted Solution

by:
kingjely earned 167 total points
ID: 33475277
Do you need OR, or AND as the operator here?

Do both date conditions need to be met in the subreport(only) OR both ?

(({MManpower.M_tTime} >= {?Pm-@Begin Range} and
{MManpower.M_tTime} <= {?Pm-@End Range})
or
({IIncident.I_tTimeTransmit} >= {?Pm-@Begin Range} and
{IIncident.I_tTimeTransmit} <= {?Pm-@End Range}))
0
 
LVL 11

Assisted Solution

by:tickett
tickett earned 167 total points
ID: 33478033
Yes- be careful about grouping AND/OR statements.

Instead of {table.timeField} <= {?begin} and {table.timeField} >= {?end} you could do:

{table.timeField} in {?begin} to {?end}

Would neaten things up a little.

L
0
 
LVL 100

Assisted Solution

by:mlmcc
mlmcc earned 166 total points
ID: 33482307
If this is in the subreport then just change the selection formula to reflect using both fields.

mlmcc
0
 

Author Closing Comment

by:Chopp
ID: 33513016
Thank you, Experts.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

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…
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 …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
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…

825 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