122
Views
7
Comments
Solved
Format Decimal\Integer to Dollars with 2 decimals.
Question

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

Rank: #1567
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.


Rank: #91

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


Rank: #1567

Rahul,

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


FrankCLT

Rank: #1567

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