?
Solved

incrementing months

Posted on 2006-06-16
5
Medium Priority
?
258 Views
Last Modified: 2010-05-18
i want to set up a table that will hold a payment plan information. basically:
id no.
start date: 06/01/06 (global)
original amount:  $300.00  (global)
payment day of month: 15
Amount of Payment:  $100.00


i would like to know if there is a way that i use a loop to populate the records for an id no. by putting in the information and having it go through and set up the payment plan until it hits the original amount?

example
Date        Amount
6/15/06   $100.00
7/15/06   $100.00
8/15/06   $100.00
0
Comment
Question by:kauakea
[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
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 19

Assisted Solution

by:billmercer
billmercer earned 400 total points
ID: 16924611
This sounds fairly straightforward.  

Create globals (or script variables if yoiu're using v8) to hold working values called Balance and DueDate.

Create a script that starts by setting Balance = original amount and set DueDate = start date

Add a loop structure that starts by creating a new record, then compares the Balance to the payment amount.
If the payment amount is less than the Balance, then set that record's payment to the payment amount, and date to the DueDate.
Then subtract the payment amount from Balance and add one month to DueDate.
If the payment amount is greater than Balance, set the payment to Balance instead, and exit the loop.



0
 

Author Comment

by:kauakea
ID: 16924623
how do i get the duedate by month. ie december 15, 2005, january 15, 2006, february 16, 2006???
0
 
LVL 19

Expert Comment

by:billmercer
ID: 16925099
Don't add a number of days, use FileMaker's date functions to increment just the date portion by one month.
Like this:

MyDate = Date ( Month ( MyDate ) + 1; Day( MyDate ) ; Year( MyDate ) )
0
 
LVL 28

Expert Comment

by:lesouef
ID: 16925586
the beauty of this function is that it controls over/underflow itself. if you set january - 1 , it automatically decrement thes year and set the month to december, so you never care about anything else but months. same thing applies to days (to find last day of the month, use date ((1st day of next month) - 1). quite good for invoices due dates...
0
 
LVL 28

Accepted Solution

by:
lesouef earned 1600 total points
ID: 16925909
just in case, a little example.
http://www.lesouef.net/files/due_dates.fp7
I have done what you need, but I think it would be easier to use if you would set the amount of months to calculate the monthly amount instead doing the opposite...
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Pop up windows can be a useful feature of any Filemaker database.  Though best used sparingly, they can be employed in a multitude of different ways, for example;  as a splash screen at login, during scripted processes to control user input, as pick…
Having just upgraded from Filemaker 11 to Filemaker 12 over the weekend, we thought we would add some tips for others making the same move.  In general, our installation went without incident. Please note that this is not a replacement for Chapter 5…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

800 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