# Amount2CSV ( amount )

Formats an amount in csv format

Average rating: 4.8 (24 votes) Log in to vote

Martin Spanjaard - Show more from this author
Trias Digitaal http://www.triasdigitaal.nl |

Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

© Martin Spanjaard, Trias Digitaal, 2014

Formats an amount so it can be used in an export in csv format.

No thousand separators, only a decimal separator, which can be given as argument or is a period by default, and just two numbers behind the decimal separator.

## Comments

comment, VR May 7, 2014 |
||

You should round BEFORE you take the Int() - otherwise you are liable to get weird results, such as 9.995 being "formatted" as "9.00". | ||

Martin Spanjaard, Trias Digitaal May 7, 2014 |
||

Yes and no, VR is right, the result of the original calculation [round( amount ; 2 ) * 100] was wrong with numbers like 9,995. But rounding is not necessary at all to get the decimal part of the number. Multiply by 100, take the integer, and then the last two numbers form the correct decimal part. But perhaps that is what VR meant. So I corrected the calculation. |
||

comment, VR May 8, 2014 |
||

My point was that you cannot round only the decimal part of a number. As for rounding being necessary at all, that's for you to decide. I presume you had the rounding there in the first place to make sure that 0.099 would be shown as "0.10" instead of "0.09" as it does now. |
||

Martin Spanjaard, Trias Digitaal May 11, 2014 |
||

VR was and is totally right. Thanks |
||

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.