Solved

zero records returned when start and end date are the same

Posted on 2012-04-05
3
281 Views
Last Modified: 2012-04-26
When I enter a date range that uses the same for start and end values I get zero records returned al though if I loo in the db I can find a few records that match that criteria.

When I look at the SQL query in Crystal, I see that the record selection date range changes, and the <= show only as <

Seems this happens automatically on crystal.

How can I avoid that?

Thanks.
0
Comment
Question by:metropia
3 Comments
 
LVL 39

Assisted Solution

by:Kyle Abrahams
Kyle Abrahams earned 166 total points
Comment Utility
Use a stored procedure.

Also be aware of the times . . . if you have both start and end date @ 12:00 AM then it will only return anything that is exactly at that time.
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 167 total points
Comment Utility
Your records probably have a time associated with the date so you need to compare just the date or use

{DateField} >= {?DateParameter} AND {DateField} <= {?DateParameter} + 1

mlmcc
0
 
LVL 34

Assisted Solution

by:James0628
James0628 earned 167 total points
Comment Utility
Interesting point about the <= being changed to <.  That seems to just be the way that CR handles a <= datetime test.  In the query, it adds 1 second to the time and replaces the <= with <.  I don't know why it does that.  My best guess would be some kind of question/problem with precision, or something like that.  So it adds a second and uses < instead.  I don't know if it always does that.  It may depend on your datasource.  In my case I was using a test report that reads an Excel file.

 So
 1) I don't think there's anything you can do to avoid it.  _Maybe_ if you use a different datasource.  I kind of doubt that it would make any difference, but I can't rule it out.
 2) It shouldn't be a problem.  CR is adding 1 second, so the results should be the same.


 The most likely explanation for not finding the records would seem to be what the others suggested, that the times are not within your range.

 James
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

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 explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
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

12 Experts available now in Live!

Get 1:1 Help Now