Format Decimal\Integer to Dollars with 2 decimals.

Hello again,


I have a decimal \ integer that i would like to format to dollars and cents......

Variable A = 123456 I would like Variable A to look like  $1234.56

I have tried the following 

FormatCurrency(Variable A, "$", 2, ",", ".") = "$123,456.00"

Thank you all,

FrankCLT

Hi FrankCLT

 try this-

SyntaxEditor Code Snippet

FormatCurrency(1234.56,"$", 2, ".", "")=$1234.56

And you variable should have decimal value other it will append .00 like 

$123456.00


Regards

Rahul Sahu


Rahul,

Thanks for the reply....but Variable A does not have any decimals.   It is coming in as 123456 from our ERP.


FrankCLT

FrankCLT wrote:

Rahul,

Thanks for the reply....but Variable A does not have any decimals.   It is coming in as 123456 from our ERP.


FrankCLT

If Variable A content 123456 than it will show $123456.00.


Regards

Rahul


So there is no way of changing 123456 to $1234.56?

FrankCLT wrote:

So there is no way of changing 123456 to $1234.56?


you need to add extra logic from your side like which integer come from application before two place you add decimal in this after that you can use FormatCurrency().


Regards

Rahul Sahu


FrankCLT wrote:

So there is no way of changing 123456 to $1234.56?

hi try it  once -

SyntaxEditor Code Snippet


Variable A=123456


FormatCurrency(TextToDecimal((Substr(A,0,Length(A)-2)+"."+Substr(A,Length(A)-2,Length(A)))),"$", 2, ".", "")

 it will give you output - $1234.56

Regards

Rahul Sahu

Solution

Rahul Sahu wrote:

FrankCLT wrote:

So there is no way of changing 123456 to $1234.56?

hi try it  once -

SyntaxEditor Code Snippet


Variable A=123456


FormatCurrency(TextToDecimal((Substr(A,0,Length(A)-2)+"."+Substr(A,Length(A)-2,Length(A)))),"$", 2, ".", "")

 it will give you output - $1234.56

Regards

Rahul Sahu

Awesome.....Rahul, worked like a charm.  Thank you very much.


Solution