DisplayRounDecimals ( )

Function stats

Average user rating
128
226
9999
Support
FileMaker 8.5 +
Date posted
20 May 2009
Last updated
20 May 2009
Version
Recursive function
No

Author Info
 Eric

7 functions

Average Rating None

author_avatar



 

Function overview

Prototype

DisplayRounDecimals  ( number;   decimals;   separator )


Parameters

number  


decimals  


separator  


Description

Tags:  Number   Format   

this allows you to determine the number of decimals and the separator that will be displayed with the Roud function.
It is necessary because the rounding function removes the 0 at the beginning or end of decimals number

Examples

Sample input

DisplayRounDecimals (0,009; 2; ",")
DisplayRounDecimals (-4,0999; 3; ".")


Sample output

0,01
-4.100

 

Function code

/* DisplayRounDecimals ( )
by Eric Plassot
may 09
Not more than 9 decimals
Not recursive

this allows you to determine the number of decimals and the separator that will be displayed with the Roud function.*/

Let([
ro=Round ( number;decimals) ;
i=Case(ro < 0 and Int (ro) = 0;"-" & Int (ro);Int (ro));
d=Left(Filter(ro-i;"0123456789") & "00000000";decimals);
re=i & separator & d
];Case(ro=0;ro;Case(ro;re) )
)

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

    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/226

    Prototype: DisplayRounDecimals( number; decimals; separator )
    Function Author: Eric (http://www.fmfunctions.com/mid/128)
    Last updated: 20 May 2009
    Version: 1.2

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

 

 

 

 

 

 

 

Top Tags

Text Parsing  (33)
List  (31)
Date  (28)
XML  (26)
Format  (23)
Sql  (22)
Dev  (20)
Debug  (17)
Interface  (15)
Layout  (15)
Text  (14)
Variables  (12)
Layout Objects  (11)
Filter  (11)
Design  (10)
Array  (7)