Solved

Crystal Reports Record Selection Formula Based on Two Date Fields

Posted on 2010-08-19
4
923 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
[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
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 101

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

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 is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

691 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