4 Replies Latest reply on Aug 17, 2012 10:16 AM by JillX_1

Email format problem

Title

Email format problem

Post

I am writing email containing currency number.

In the original layout, I use currency display and chosed thousands seporator and fixed 2 dicemals. While in email, I use calculation to get value of currency field. While in email, the currency format is not consistent from original layout.

My question is: how can I add thousands seporator and 2 dicemals in email content?

Thank you!

• 1. Re: Email format problem

You'll need a calculation to supply the currency format with thousands separator and two decimal places.

Let ( [ n = YourTable::YourCurrencyField ;
gt1000 = int ( n / 1000 ) * 1000 ;
gt1000b = gt1000 / 1000 ;
le1000a = n - gt1000 ;
le1000b = int ( le1000a ) ;
dec = Round ( ( le1000a - le1000b ) * 100 ; 0 )
] ;

"\$" & If ( gt1000 ; gt1000b & "," & Right ( "000" & le1000b ; 3 ) ;  le1000b ) & "." &  left ( dec & "00" ; 2 )
)

This can also be set up as a custom function if you have FileMaker Advanced.

// Currency ( cSymbol ; thDelim ; dSymbol ; n )

// Returns number n  as text formatted to include cSymbol as the currency symbol, thDelim as the thousands delimitter and dSymbol as the decimal place symbol
// Created by Phil Caulkins aka "PhilModJunk" 8/17/2012

Let ( [ gt1000 = Int ( n / 1000 ) * 1000 ;
gt1000b = gt1000 / 1000 ;
le1000a = n - gt1000 ;
le1000b = Int ( le1000a ) ;
dec = Round ( ( le1000a - le1000b ) * 100 ; 0 )
] ;

cSymbol & If ( gt1000 ; gt1000b & thDelim & Right ( "000" & le1000b ; 3 ) ;  le1000b ) & dSymbol &  Left ( dec & "00" ; 2 )
)

• 2. Re: Email format problem

Thank you Phil!!

I tried with your first script, and I got two decimal successfully, but still did not get thousands saparator.

Another question is : where I can start setting up custom function in FMP advanced?

• 3. Re: Email format problem

I tested both versions before I posted. Better compare your version of the calculation to mine to see if you can spot an error.

You can select manage | custom functions to open up a dialog for creating a custom function. You can copy and paste from the forum into the custom function editor, but you'll need to separately enter the function name and the list of parameters. The custom function has been designed so that you can specify the format symbols specific to your geographic location and economy.

• 4. Re: Email format problem

Oh I see the thousand separator coming,

Thank you so much Phil!