Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If..Then..else.. error

Status
Not open for further replies.

vbjohn

Programmer
Aug 23, 2001
67
0
0
US
Can someone tell me why is this not working?

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};
 
If you want the if clause to apply to each line, then you need to use parens:
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}
);

You should always specify what you mean when you say something is not working, e.g., you are getting a specific error message, the results are incorrect and in what way, etc.

-LB

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top