Using CRXI with an ODBC database, I'm trying to build a date range which depends on the day of the week of a date type parameter. The Date range will always be a Saturday to Friday Range. Once I know the day of the week, I can build my date range by adding to or subtracting from the date entered.
My code below seems pretty simple to me, however it produces an error indicating that the word "else" is missing at the very end of the code. I'm hoping that someone might see something I've left out. BTW - changing the entire thing to a big if/else structure results in same error...
Any Help would be greatly appreciated...
My code below seems pretty simple to me, however it produces an error indicating that the word "else" is missing at the very end of the code. I'm hoping that someone might see something I've left out. BTW - changing the entire thing to a big if/else structure results in same error...
Any Help would be greatly appreciated...
Code:
//Sun = 1 , Sat = 7 Client work week = Sat thru Friday or 7 thru 6
select DayOfWeek({?Work Day})
case 1 : shared datevar Range Week1:= cdate(DateAdd("d",-1 ,{?Work Day})) to cdate(DateAdd("d",5 ,{?Work Day}))
case 2 : shared datevar Range Week1:= cdate(DateAdd("d",-2 ,{?Work Day})) to cdate(DateAdd("d",4 ,{?Work Day}))
case 3 : shared datevar Range Week1:= cdate(DateAdd("d",-3 ,{?Work Day})) to cdate(DateAdd("d",3 ,{?Work Day}))
case 4 : shared datevar Range Week1:= cdate(DateAdd("d",-4 ,{?Work Day})) to cdate(DateAdd("d",2 ,{?Work Day}))
case 5 : shared datevar Range Week1:= cdate(DateAdd("d",-5 ,{?Work Day})) to cdate(DateAdd("d",1 ,{?Work Day}))
case 6 : shared datevar Range Week1:= cdate(DateAdd("d",-6 ,{?Work Day})) to cdate(DateAdd("d",0 ,{?Work Day}))
case 7 : shared datevar Range Week1:= cdate(DateAdd("d",-0 ,{?Work Day})) to cdate(DateAdd("d",6 ,{?Work Day}))