6. Functions : Finance Library Functions : PPMT Function : Example—PPMT function:
 
Share this page                  
Example—PPMT function:
/*  In the following example period and principle are
**  EntryFields of DataType Float. A specific period
**  would be entered in the period field. There is
**  also a ButtonField named btn_ppmt. The frame
**  script is shown below. The loan is for $10,000
**  for 48 months at 7% interest per year.
*/
on initialize =
declare
    context = PMT_CONTEXT;
enddeclare
on click btn_ppmt =
begin
principal = ppmt(period = period,
pv = 10000,
i = .07/12,
nper = 48,
fv = 0,
paybegin = 0,
context = byref(context));
if principal is NULL then
message 'Failed to calculate principle portion';
endif;
end