# Creating Amortization Schedule Report

I am trying to create an amortization schedule report using Crystal Reports 8.0, however, I cant seem to figure out how to get it to loop until the balance is 0. Any idea on how to do this?

Thanks
Asked:
###### Who is Participating?

Commented:
The only way around that is to upgrade to a more recent version of Crystal.  CR9 for example supports strings up to 65534 characters.

You could also look into using an array of strings (stringVar array Result) but this would probably only work effectively if you used on array element for each payment which means you would have to have a fixed number of payments.

You know, as much as I like using Crystal it isn't the answer for everthing.  IMHO you should probably be doing this in Excel instead as it has built in functions to handle this and can be done much more efficiently.  Just a thought because it sounds like you've got an older version of CR and I don't think you're going to be able to solve this problem here.

Good luck though,

frodoman
0

Commented:
Here's the basic code for a loop:

numberVar RemainingBalance := 10000;
do
(
RemainingBalance := RemainingBalance - 150;
)
while RemainingBalance > 0;

0

Author Commented:
So how do I get it to print a record for each payment?
0

Commented:
You can't print a record for each payment but you can print a single record showing all payments - obviously you'll need to add the code for calculating the payment amount and interest, etc.  You'll probably want to add logic to make sure the last payment isn't more than the remaining balance, etc.

This Crystal formula contains all of the structure that you need - you'll just have to add the mathmatic formula you want to use.

numberVar RemainingBalance := 10000;
numberVar PayAmount;
numberVar IntAmount;
stringVar LineBreak := chr(10) + chr(13);
stringVar Results := '';  <-- That's two single quotes, not a double quote
do
(
PayAmount := 150;
Results := Results + ' Payment Amount: ' + ToText(PayAmount,2);
RemainingBalance := RemainingBalance - PayAmount;
IntAmount := 15;
RemainingBalance := RemainingBalance + IntAmount;
Results := Results + ' Interest: ' + ToText(IntAmount,2) + ' New Balance: ' + ToText(RemainingBalance,2);
Results := Results + LineBreak;
)
while RemainingBalance > 0;
Results;

0

Commented:

If you want to print a record for each payment then use a For loop instead of a Do loop. With the FOR loop you can specify how many payments or how many years you are doing the amortization for. ie:

numberVar Payment :=1400;
numberVar Balance :=1400;

Dim X
For X = 1 to 360                              // 1 payment for each month for 30 years
Balance :=Balance - Payment;        // payment calc
Balance                                        // Shows balance after payment applied for each month
Next X

Sorry for being so rough/vague, its early for me and doing this from memory. Later in the day I can write through this better or in more detailed. Hoping this will help give you an idea.

And my reason for saying do a Do loop is because (i think) when it prints out it would display as 1 long formula, instead of doing it after every payment. But you should be able to put just the variable for the new amount after the payment calculation to print a balance after every payment.
0

Commented:
Well ther ya have it. I like frodoman's answer much better. mine was just a quickie and i havent had any coffee yet.
0

Author Commented:
I created a formula field and copied the above formula into it and put it in the Details section of the report. When I run it, it tells me "A string can be at most 254 characters long." Any way around this?

Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

## Already a member? Login.

All Courses

From novice to tech pro — start learning today.