Solved

Creating Amortization Schedule Report

Posted on 2004-03-26
9
882 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

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…
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

828 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