Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

# Creating Amortization Schedule Report

Posted on 2004-03-26
Medium Priority
906 Views
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
0
Question by:jquintero33
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 3
• 2
• 2

LVL 42

Expert Comment

ID: 10687907
Here's the basic code for a loop:

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

0

Author Comment

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

LVL 42

Expert Comment

ID: 10688445
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

LVL 10

Expert Comment

ID: 10688580

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

LVL 10

Expert Comment

ID: 10688609
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 Comment

ID: 10688618
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

LVL 42

Accepted Solution

frodoman earned 120 total points
ID: 10689364
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

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirementsâ€¦
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearlyâ€¦
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vulnâ€¦
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonstâ€¦
###### Suggested Courses
Course of the Month4 days, 21 hours left to enroll