Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Not Able to Select Appropriate Data 1

Status
Not open for further replies.

leedy33

Technical User
Jun 15, 2005
51
0
0
US
Im using crystal 8.5 and I'm running my database through ODBC. In my report i have about six columns of infromation, with numerous rows associated with each. For each sample, the columns have information related to that sample. What I'm trying to do is create a report where it only shows the samples that were received on a certian date. I have a column called received date, that corresponds with each sample.
When i go to "Edit Selection Formula" and I enter:
--> (ReceivedDate)= (Date)
With (Date) meaning any date that i choose, the screen goes blank. And this is when i enter a date in which i can see before that has samples assosociated with it.
I have then tried to use a parameter but the same thing happens again. Any suggestions as to why and how this can be worked around or fixed. Thanks
 
Hi,
Is the {ReceivedDate} field a Date or a DateTime ( sometimes called a Timestamp)? If a DateTime, a simple = may not return any rows does to mismatching on the time component..

First Try:
{ReceivedDate} >= {?Date}
( or <= depending on what you want)

If that returns data, then use the conversion functions in CR ( or, beter yet, in a view in your database) to
change {RecievedDate} to just its Date component befoe using the = comparison.




[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
In looking at my {ReceievedDate} it appears to be a DateTime. And when I use the >= or <= it works just right. How do i go about using the CR to change my {ReceivedDate} from DateTime to just Date. Thanks
 
Also one other question that i have, is that in this report i want to be able to pull up the data that was Recieved the day before, so the (ReceivedDate) would = currentDate-1 or some sort. The problem that i then come across is what happens on Monday, when i want to pull up fridays information. I was just wondering if there is anyway to setup the dates so it will recognize when this happens, if not then i will have to make do. Thanks again.
 
Hi,
OK..The Date({DateTimeField}) function returns just the Date portion of the field..So, to do what you want, first test for the day of the week and then act accordingly:

Code:
If DateOfWeek({ReceivedDate}) = 2   // Monday
then
 Date({ReceivedDate}) >= (CurrentDate - 3) // Go to Friday
else
If DateOfWeek({ReceivedDate}) in [3,4,5,6]  // Other weekdays
then
Date({ReceivedDate}) = (CurrentDate - 1) //Yesterday only

If you will never run this except on a week day, then you can use If DateOfWeek({ReceivedDate}) <> 2
for the Else clause

Hope it helps..

[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top