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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Range Formula Error

Status
Not open for further replies.

jahistx

Technical User
Jun 21, 2002
94
GB
Hi

I am using Crystal Reports 8.5 Pro, and I need to return the result of a calculation where a date range parameter is satisfied.

I have put the following formula:

IF {reqdate} IN #01/09/2007# TO #30/09/2007# THEN {qty} * {weight} ELSE 0

However when I sum this value it is incorrect. Further invesigation shows that transactions outside of this date range are being included in the total calculation! What am I doing wrong? Help!
 
Im just curious .... are you trying to find the range between September 1st and September 30th?
because I believe your format is looking between January 1st and Spetember 30th...

try
IF {reqdate} IN #09/01/2007# TO #09/30/2007# THEN {qty} * {weight} ELSE 0
I know crystal interprets 30/09/2007 as September 30th but for me that gets confusing .....
 
CoSpringsGuy is right about the order of the date elements, and that should work, but if you have a daterange parameter, then why not use:

if {reqdate} IN {?daterange} THEN {qty} * {weight}

-LB


 
Thanks guys, it was just the US date format rather than the UK format which was causing a problem.

Swapped the day and month components and all working now.

The reason for not selecting the daterange parameter is that the September selection is one of twelve formulae in the report to define each calendar month.

Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top