View Single Post
  #1 (permalink)  
Old October 17th, 2006, 05:17 PM
MrPearl MrPearl is offline
Registered User
 
Join Date: Oct 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Crystal If Else Then syntax

I'm new to Crystal and am having an error, please help:

If ({ITEM.user_field_Contract_Start} < {?start date}) and ({ITEM.user_field_Contract_End} > {?end date}) then
datediff(d, {?start date}, {?end date})+1
else If ({ITEM.user_field_Contract_Start} >= {?start date}) and ({ITEM.user_field_Contract_End} <= {?end date}) then
datediff(d, {ITEM.user_field_Contract_Start}, {ITEM.user_field_Contract_End})
else if ({ITEM.user_field_Contract_Start} >= {?start date}) and (({ITEM.user_field_Contract_Start} <= {?end date}) and ({ITEM.user_field_Contract_End} > {?end date})) then
datediff(d, {ITEM.user_field_Contract_Start}, {?end date})
else
datediff(d, {?start date}, {ITEM.user_field_Contract_End})+1;

I hope that isn't to ugly to look at. A switch could work too I suppose.
My report has 2 parameters:
?start date
?end date

tia