loan.SETFILTER(balance,'>0'); loan.SETFILTER("Freeze Loan",'No'); IF loan.FINDSET THEN BEGIN IF (loan.balance > 0.0) THEN BEGIN REPEAT op_bal := loan.balance; cl_bal := loan.balance - loan.monthly_pay; paidoff := loan.loan_amount - cl_bal; loan.paidoffamount := paidoff; loan.MODIFY; loan.balance := cl_bal; loan.MODIFY; { //insert into loan history table. history.id += 1; history.op_balance:= op_bal; history.cl_balance:=cl_bal; history.ded_amount := loan.monthly_pay; history.int_amount := loan.monthly_int; history.loan_id := loan.id; history.MODIFY; } UNTIL loan.NEXT = 0; END; END; //display result on a report view.RUN;
Comments
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
The code will also work without the SETCURRENTKEY, but probably it will be slower because the whole table will be scanned (even with the SETCURRENTKEY it is possible the whole table will be scanned on SQL. This depends on how many data and the data itself : if the number of records with "Freeze Loan" = FALSE is below 5% of the total, the index will probably be used)
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!