# Combining multiple IF and AND statements in Crystal Syntax?



## Son_Yaqin (Jul 20, 2010)

Hi,

I am trying to create a formula where my report shows either YES or NO next to each record, depending on if a criteria has been met or not.

Simply put, the F_irstVisitDate_ must be within 14 days of the Tenanted Date - i.e:

_*



if (({Command.TenantedDate} + {@target.date}) < {Command.FirstVisitDate}) then "No" else "Yes" 

Click to expand...

*_HOWEVER, some staff have not entered a _FirstVisitDate_ therefore null values are not showing any results. 

I need to therefore create a formula that states the above formula 

plus

if the value is NULL and the CurrentDate is 14 Days (target date) over the TenantedDate then "No" 

The code below works fine seperately but when I combine it does not work. 



> *if (({Command.TenantedDate} + {@target.date}) < {Command.FirstVisitDate}) then "No" else "Yes" *
> 
> *OR *
> 
> ...


Please help?

Thanks


----------



## Son_Yaqin (Jul 20, 2010)

OK I think I solved it - brackets madness!



> if (IsNull({Command.FirstVisitDate}) AND (CurrentDate > ({Command.TenantedDate}+ {@target.date})))
> 
> OR (({Command.TenantedDate} + {@target.date}) < {Command.FirstVisitDate})
> 
> then "No" else "Yes"


----------

