Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Formula Tool Question

saundankarro
6 - Meteoroid

Hello all,

 

I'm new to Alteryx and I wasn't sure where to ask this, so please excuse me if I posted in the wrong place.

 

I was going over the Build your First Macro! video made by JoeM, and he went over the tostring function of the Formula tool. In it, he had mentioned how you could set commas when converting doubles to string by using tostring([Column], 2, 1). He had mentioned how removing the 1 also removes the comma, but he hadn't mentioned any other number. I just wanted to confirm whether it's a 1 being on/0 being off setting, or if using another number there would change the placement of the commas. The reason I ask is because I know it's typical in many places to have a comma every third number, but I know in India, it's common to have a comma after the hundred thousand spot (i.e. 9,999,999 vs 99,99,999) or after the ten million spot (i.e. 9,99,99,999 vs 99,999,999). I haven't actually gotten Alteryx yet so I'm unable to test it out.

 

Thank you in advance!

2 REPLIES 2
fmvizcaino
17 - Castor
17 - Castor

Hi @saundankarro ,

 

You can find all examples here at the end of this page.

https://help.alteryx.com/current/designer/conversion-functions

 

Spoiler

ToString(x, numDec, [addThousandsSeparator], [decimalSeparator]): Converts a numeric parameter to a string using numDecdecimal places. By default, the period is used as the decimal separator.

OPTIONAL PARAMETERS

addThousandsSeparator: 0 (default) formats the numeric string without a thousands separator; 1 formats with a thousands separator. By default, the thousands separator is a comma unless "," is specified for decimalSeparator, in which case it is a period.

decimalSeparator: "." (default) specifies the period as decimal separator; "," specifies the comma as decimal separator.

EXAMPLE

ToString(10, 0) returns 10 as a string.

ToString(10.4, 2) returns 10.40 as a string.

ToString(100.4, 2) returns 100.40 as a string.

ToString(1000.4, 2, 1) returns 1,000.40 as a string.

ToString(123456.789, 3, 1, ",") returns 123.456,789 as a string.

ToString(123456.789, 3, 0, ",") returns 123456,789 as a string.

Best,

Fernando Vizcaino

saundankarro
6 - Meteoroid

Thank you so much!

Labels