Brian Dunning's FileMaker Custom Functions

Amount2CSV ( amount )

Formats an amount in csv format

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

Martin Spanjaard   Martin Spanjaard - Show more from this author
Trias Digitaal

Share on Facebook Share on Twitter

  Sample input:
Amount2CSV ( "1.200,21" ; "." )
  Sample output:

  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.



comment   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   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   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   Martin Spanjaard, Trias Digitaal
May 11, 2014
VR was and is totally right.

Log in to post comments.


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

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 15 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: