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
*/
// ===================================
/* DisplayRounDecimals ( )__LITBR__by Eric Plassot__LITBR__may 09__LITBR__Not more than 9 decimals__LITBR__Not recursive__LITBR____LITBR__this allows you to determine the number of decimals and the separator that will be displayed with the Roud function.*/__LITBR____LITBR__Let([__LITBR__ro=Round ( number;decimals) ;__LITBR__i=Case(ro < 0 and Int (ro) = 0;"-" & Int (ro);Int (ro));__LITBR__d=Left(Filter(ro-i;"0123456789") & "00000000";decimals);__LITBR__re=i & separator & d__LITBR__];Case(ro=0;ro;Case(ro;re) )__LITBR__)__LITBR____LITBR__// ===================================__LITBR__/*__LITBR____LITBR__ This function is published on FileMaker Custom Functions__LITBR__ to check for updates and provide feedback and bug reports__LITBR__ please visit http://www.fmfunctions.com/fid/226__LITBR____LITBR__ Prototype: DisplayRounDecimals( number; decimals; separator )__LITBR__ Function Author: Eric (http://www.fmfunctions.com/mid/128)__LITBR__ Last updated: 20 May 2009__LITBR__ Version: 1.2__LITBR____LITBR__*/__LITBR__// ===================================
Login or register to comment
Create a new account with fmcustomfunctions.com or login to post a comment.