Terms_Amount ( )

Function stats

Average user rating
157
205
9999
Support
FileMaker 7.0 +
Date posted
19 February 2009
Version
1
Recursive function
No

Author Info
 Drew Sanderson

1 functions

Average Rating None

author_avatar



 

Function overview

Prototype

Terms_Amount  ( Amount;   Periods;   Value )


Parameters

Amount  This is for the sum that needs to be divided up


Periods  Number of divisions (terms) the amount is divided into.


Value  Specifies which of the two number generated to retrieve.


Description

This is used to figure the proper amount to be applied when figuring out terms. In the example, simply dividing 2267 by 3 payments would result in 755.6666666667. Using this function will result in two answers depending on the parameter passed. Passing the parameter of "low" give you the low amount and passing "high" will give you the higher amount.

Examples

Sample input

Term_Amount ( 2267 ; 3 ; "low" )


Sample output

755

 

Function code

Let
(
[
$integer = Abs ( Amount ) ;
$decimal = Amount - $integer ;
$remainder = Mod ( $integer ; Periods ) ;
$extra = $remainder + $decimal ;
$period_value_low = ($integer - $remainder) / Periods ;
$period_value_high = $period_value_low + $extra
];

Case
(
Value = "low" ; $period_value_low ;
Value = "high" ; $period_value_high
)

)

// ===================================
/*

    This function is published on FileMaker Custom Functions
    to check for updates and provide feedback and bug reports
    please visit http://www.fmfunctions.com/fid/205

    Prototype: Terms_Amount( Amount; Periods; Value )
    Function Author: Drew Sanderson (http://www.fmfunctions.com/mid/157)
    Last updated: 19 February 2009
    Version: 1

*/
// ===================================

 

 

 

 


Login or register to comment

Create a new account with fmcustomfunctions.com or login to post a comment.

 

 

 

Top Tags

Text Parsing  (31)
List  (20)
XML  (20)
Date  (19)
Format  (18)
Debug  (12)
Dev  (11)
Variables  (11)
Layout  (11)
Interface  (10)
Text  (10)
Filter  (10)
ValueIterator  (6)
Layout Objects  (6)
Uuid  (6)
HTML  (6)