Question : Selection Formula

I am using crystal reports 9.2 to create a report. to make the report more interactive i am adding some code behind the report(selection formula). I am using this formula to generate 3 dates and on basis of these dates I want to filter records. here is the sample.

dateVar x;
x:= Date(CurrentDateTime);

dateVar x1;


if DayOfWeek (x1)=1 then
x1 :=CDate(DateAdd ("d",-2 ,x1));
if DayOfWeek (x1) = 7 then
x1 :=CDate(DateAdd ("d",-1 ,x1));



{coer.ND_Response_Due}=x1 and
{coer.TOYEAR}={?Year} and
{coer.ST}={?STATE} and
{coer.Defective_Flag}="YES"


but in this code i am not getting require results. It seems that "if" condition is not being evaluated at all. Can you plz help me

Answer : Selection Formula

dateVar x;
x:= Date(CurrentDateTime);

dateVar x1;


if DayOfWeek (x)=1 then
x1 :=CDate(DateAdd ("d",-2 ,x));
if DayOfWeek (x) = 7 then
x1 :=CDate(DateAdd ("d",-1 ,x));



{coer.ND_Response_Due}=x1 and
{coer.TOYEAR}={?Year} and
{coer.ST}={?STATE} and
{coer.Defective_Flag}="YES"
Random Solutions  
 
programming4us programming4us