Having trouble with basic if then else Crystal Report Syntax.

Hello, can you please help me tidy up this if then else statement.  I jsut can get the ;'s in the right place or the format right.  It keeps giving me an error on the second part:

if {tblTaskLock.PaymentTerms} <> "N30" then
(Local DateVar Start := Cdate({tblRevisions.CheckerComplete}+1);
Local DateVar End := CDate({tblRevisions.CurrentRevisionOut}));
else
if {tblTaskLock.PaymentTerms} <> "N45" then
(Local DateVar Start := Cdate({tblRevisions.CheckerComplete}+2);
Local DateVar End := CDate({tblRevisions.CurrentRevisionOut}));
else
(Local DateVar Start := Cdate({tblRevisions.CheckerComplete}+3);
Local DateVar End := CDate({tblRevisions.CurrentRevisionOut}));


Thanks,
joel
Genius123Asked:
Who is Participating?
 
mlmccCommented:
I prefer to declare the variables at the beginning

Local DateVar Start ;
Local DateVar End ;

if {tblTaskLock.PaymentTerms} <> "N30" then
(
      Start := Cdate({tblRevisions.CheckerComplete}+1);
      End := CDate({tblRevisions.CurrentRevisionOut});
)
else if {tblTaskLock.PaymentTerms} <> "N45" then
(
     Start := Cdate({tblRevisions.CheckerComplete}+2);
     End := CDate({tblRevisions.CurrentRevisionOut});
)
else
(
    Start := Cdate({tblRevisions.CheckerComplete}+3);
    End := CDate({tblRevisions.CurrentRevisionOut});
);

I assume there is more to the formula since you have them declared as LOCAL.

mlmcc
0
 
mlmccCommented:
if {tblTaskLock.PaymentTerms} <> "N30" then
(
      Local DateVar Start := Cdate({tblRevisions.CheckerComplete}+1);
      Local DateVar End := CDate({tblRevisions.CurrentRevisionOut});
)
else if {tblTaskLock.PaymentTerms} <> "N45" then
(
     Local DateVar Start := Cdate({tblRevisions.CheckerComplete}+2);
     Local DateVar End := CDate({tblRevisions.CurrentRevisionOut});
)
else
(
    Local DateVar Start := Cdate({tblRevisions.CheckerComplete}+3);
    Local DateVar End := CDate({tblRevisions.CurrentRevisionOut})
);


mlmcc
0
 
Genius123Author Commented:
It would have been nice if the expert taught me the format.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.