modifying data and inserting to another table

asemberengasembereng Member Posts: 220
id empid loan_amount monthly_pay total_int monthly_int int_rate balance loan Type paidoffamount
1 A001 5,000.00 500.00 1,000.00 100.00 2.00 5,000.00 0.00
2 A002 6,000.00 600.00 0.00 0.00 0.00 6,000.00 One by Six 0.00

i want to write a program that will go through a table called loan loop through the table modify the balance field and the paidoffamount field and then pick data from this table and dump it into another table called "loan history"


IF history.FIND('+') THEN BEGIN
NextLineNo := history.id + 1;
history.id := NextLineNo;
END;
history.INSERT;
IF loan.balance <> 0 THEN BEGIN
op_bal := loan.balance;
cl_bal := loan.balance - loan.monthly_pay;
paidoff := loan.loan_amount - loan.balance;
loan.balance :=cl_bal;
loan.paidoffamount := paidoff;
loan.modify;
history.empid :=loan.empid;
history.op_balance := op_bal;
history.cl_balance := cl_bal;
history.loan_id := loan.id;
message('%1',op_bal);
history.insert;
END;

I tried the code above but its not modifying the loan table nor writing to the loan history table. Can someone tell me why?

Comments

Sign In or Register to comment.