Click to See Complete Forum and Search --> : If...Then...Else... Error.


vbjohn
May 17th, 2007, 11:53 AM
Can someone tell me why is this not working? After the else is the error. It states that it is not part of the formula.

WhilePrintingRecords;
numberVar numNB;
numberVar numRPC;
numberVar numMC;
numberVar numMRPC;
numberVar numDPP;

numberVar numNB2;
numberVar numRPC2;
numberVar numMC2;
numberVar numMRPC2;
numberVar numDPP2;

if {tran_date} in Aged31To60Days then
numNB := numNB + Count({debtor_no});
numRPC := numRPC + {#RTotalDialerRPC};
numMC := numMC + {#RTotalManualCalled};
numMRPC := numMRPC + {#RTotalManualRPC};
numDPP := numDPP + {#RTotalPP};
else
if {tran_date} in Aged61To90Days then
numNB2 := numNB2 + Count({debtor_no});
numRPC2 := numRPC2 + {#RTotalDialerRPC};
numMC2 := numMC2 + {#RTotalManualCalled};
numMRPC2 := numMRPC2 + {#RTotalManualRPC};
numDPP2 := numDPP2 + {#RTotalPP};

JaganEllis
May 17th, 2007, 07:14 PM
If you want multiple statements to run after a condition check then enclose them in brackets. e.g.

if {tran_date} in Aged31To60Days then
(
numNB := numNB + Count({debtor_no});
numRPC := numRPC + {#RTotalDialerRPC};
numMC := numMC + {#RTotalManualCalled};
numMRPC := numMRPC + {#RTotalManualRPC};
numDPP := numDPP + {#RTotalPP};
)
else
(
if {tran_date} in Aged61To90Days then
numNB2 := numNB2 + Count({debtor_no});
numRPC2 := numRPC2 + {#RTotalDialerRPC};
numMC2 := numMC2 + {#RTotalManualCalled};
numMRPC2 := numMRPC2 + {#RTotalManualRPC};
numDPP2 := numDPP2 + {#RTotalPP};
);