Start Free Trial

Alteryx Designer Desktop Discussions

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

How to convert string to a number?

Dom
8 - Asteroid

Morning,

 

I need assistance with converting string to number.  In my trailer row I have the record count.

 

I need the count field to be  right justified, padded with zeros (8).  ex.00000732

 

I originally had right(PadLeft(ToString([Count]), 8, "0"),8) which worked when i didn't need it separated by commas. Now I need my trailer row to be comma separated instead of one string. Thanks in advance

 

Before:ZZZQUESBIO2016021900000272 

I need it to look like this ZZZ,QUES,BIO,20160219,00000272 

3 REPLIES 3
jdunkerley79
ACE Emeritus
ACE Emeritus

I would look at the regex_replace function

 

Something like:

REGEX_Replace([Field1],'^(\w{3})(\w{4})(\w{3})(\d{8})(\w{8})$','$1,$2,$3,$4,$5')

Attached a demo.

 

I assumed the field length based on your example. Regex can hopefully be adjusted to match your needs.

 

Dom
8 - Asteroid

Perfect!

Usamah22
8 - Asteroid

Hello,

 

i have a field with sales volumes such as 2,500 which is set as string when alteryx imports the input file. when i use the select tool and convert the field to a double it cuts the figures at the comma so the 2,300 becomes 2. I need to summarise and do calculations so can't keep the field as a string. How do i correctly convert the field to an integer?

Labels
Top Solution Authors