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!

Problem with Dates

Status
Not open for further replies.

Dandas

MIS
Jul 18, 2002
47
0
0
AU
Hi.

I have a report that runs every day for yeasterday and I need to be able to change it to a demand report so that I can run it for a selected day.

I have deleted the

VW_EVT_AGENT_ACTIVITY."AA_TIME_STAMP" >= TRUNC(SYSDATE) -1 AND
VW_EVT_AGENT_ACTIVITY.&quot;AA_TIME_STAMP&quot; <= TRUNC(SYSDATE)

commands out of &quot;Where&quot; in the SQL and then inserted some parameter fields (Strings) for start date and and Finish Date. I used the Select Expert to include them in the selection criteria and the SQL now reads like this

VW_EVT_AGENT_ACTIVITY.&quot;AA_TIME_STAMP&quot; >= ? AND
VW_EVT_AGENT_ACTIVITY.&quot;AA_TIME_STAMP&quot; <= ? AND

The problem is when I run the report now it comes up with no data, as if the dates were just completely wrong.

Does anyone know what this might be?

Thanks
 
I don't get it.

Where you're saying you deleted and added stuff &quot;in the SQL&quot;, I'm assuming you mean that you did this in the Record Selection or Select Expert, and this is the effect it had on the SQL. That is what you mean, right?

The other thing is this: I know VW_EVT_AGENT_ACTIVITY.&quot;AA_TIME_STAMP&quot; is a DateTime field - or at the very least, a Date field, because your last SQL that worked did a direct comparison with SYSDATE, which is a pseudo-date field.

So then why are you now using &quot;parameter fields (Strings) for start date and and Finish Date&quot;? Crystal must have tried to stop you from doing this with errors, unless you ignored the errors or converted the database field.

If your getup is like this:
Your Parameters
{YourStartDate} - (Type: DateTime or Date)
{YourEndDate} - (Type: DateTime or Date)

Your Select Expert Criteria
Code:
VW_EVT_AGENT_ACTIVITY.&quot;AA_TIME_STAMP&quot; >= {YourStartDate} AND 
VW_EVT_AGENT_ACTIVITY.&quot;AA_TIME_STAMP&quot; <= {YourEndDate}
You should be home free. If this is not working for you, post your parameter types, your selection criteria, and the value of the dates you're passing with a sample of data in the database that the report should be returning using those dates.

Naith


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top