Solved

Crystal Reports Record Selection Formula Based on Two Date Fields

Posted on 2010-08-19
4
918 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
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…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now