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

Select Case Statement making report take longer

Status
Not open for further replies.

BeeBear

Technical User
Sep 4, 2005
71
AU

Hi,

I'm using Crystal V10 on Oracle DB

I have added a Select Case statement to the record selection, but its now taking a LOT longer to run.

I had to do a nested Select Case, and I think I've done it wrong.

Can someone have a look at this and tell me how I can fix it?

(SELECT Month(cdate({?Pm-?Period End Date}))
CASE 2 :
SELECT day(cdate({?Pm-?Period End Date}))
CASE 29,30,31 :

SELECT Remainder(Year(cdate({?Pm-?Period End Date}))-1992,4)
CASE 0 :
{CWRCASE.CWRCASE_CLOSING_DATE} <=
date(Year(cdate({?Pm-?Period End Date})),Month(cdate({?Pm-?Period End Date})),29)
DEFAULT:
{CWRCASE.CWRCASE_CLOSING_DATE} <=
date(Year(cdate({?Pm-?Period End Date})),Month(cdate({?Pm-?Period End Date})),28)

DEFAULT: {CWRCASE.CWRCASE_CLOSING_DATE} <= cdate({?Pm-?Period End Date})

DEFAULT: {CWRCASE.CWRCASE_CLOSING_DATE} <= cdate({?Pm-?Period End Date})
)


The reason I had to put this in, was a user sometimes put the End Date parameter as 29 Feb when it wasnt a leap year, so that meant the report changed the 'end date' to be the report run date.

The parameters are string parameters (entered as dd/mm/yy and converted to date using cdate.

The Select Case statement is meant to say, if the month selected is Feb, and the year is not a leap year, do Day = 28 else do Day = 29.

Let me know if you need any other info.

Thanks


regards

BB

*** Count your blessings not your problems******
:)
 
Hi,
Look at the SQL being sent to Oracle to see how that statement is being parsed ( if at all)..

If it is not being sent to Oracle than all the records are being returned before the filter is applied.

look at this FAQ about pass-through criteria:

faq767-3825



[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