# Number Format (Thousand Separator)

Hi All,

I got an amount in decimal to 555777.00 which i managed to truncate into 555777. using [myInt := Amount Div 1;]

However, i would like further to change it into 555,777 with a thousand separator how can it be done ?

Check Format function in the Documentation.

Ex: Format(555777.00,15,3)

Regards,

Shravan

hi shravan,

thanks but i dont quite get what the syntax mean in the c/side help.

by the way, what does the 15 mean?

Format(MyDec, 15, 3)

Required length of result string(count will be from the left most digit),which will be finally generated by Format funcion.

EX: For instance,the MyDec Variable has Length of 8 degits(Places) then

MyDec := 12345678.00;

message(’%1’,Format(MyDec,6,3) ));

Out Put:

123,45

Hi shravan,

sad to say when i place below code in my SourceExpr: FORMAT(intAmt, STRLEN(FORMAT(intAmt)), 3)

Standard format no. 3 does not exist for the type ‘Integer’. [:’(]

No You are messed,It work for decimals.

Pass Decimal Variable to the Format Function.

Hi nikeman77,

use this

FORMAT(123456789.00, 12,’’);

don’t change your decimal into integer, use it instead of ‘123456789.00’ in above line.

it will work [:)]

Gaurav,

-------------------------------------------------------------------------------------------------

Error Message: [:O]

Overflow under type conversion of Decimal to Integer.
Value: 0.3

-------------------------------------------------------------------------------------------------

By the way the value is in tens of millions as currency involved eg:conversion of USD to Indonesia Rupiah.

FORMAT(decAmt, StrLen(FORMAT(decAmt)),’’)

Hi Gaurav,

sorry about the above error, it was variable declaration set wrongly. Your suggestions works!

Another questions, what if I would like to set the decimal with thousand separator but still retain the decimal places?

(eg: 7123456.78 => 7,123,456.78)

Try this

FORMAT(decAmt, StrLen(FORMAT(decAmt)),’<Decimals,3>’)

end result : FROM 1,234,56.78 >> 1,234,56.***

[:^)]

Check Format function in the Documentation.

Ex: Format(555777.00,15,3)

Regards,

Shravan

Hi Shravan,

Got it resolved with FORMAT(decAmt,0,3)
results very pleasing from [534557.77] to 534,557
Achieving 2 things for one getting rid of the decimal, secondly get the thousand separator…
thank you every one for helping out and your valuable propositions ! Kudos! [Y]

[D]