Solved

Creating Amortization Schedule Report

Posted on 2004-03-26
9
880 Views
Last Modified: 2006-11-17
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
Comment
Question by:jquintero33
  • 3
  • 2
  • 2
9 Comments
 
LVL 42

Expert Comment

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

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

0
 

Author Comment

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

Expert Comment

by:frodoman
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 10

Expert Comment

by:Jstncase
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

by:Jstncase
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

by:jquintero33
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

by:
frodoman earned 30 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now