Alteryx Designer Desktop Discussions

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

Left padding wth spaces

krankin
7 - Meteor
Hello, I would like to left pad a string with spaces to a total number of characters. I've tried to use PadLeft([field],12," "), but the space in between the quotes is not being read. If I put in a character, it works, but I need spaces. Any ideas?
6 REPLIES 6
Claje
14 - Magnetar
Hi, I just tested this and it worked, the space was properly read. Are you trying to put 12 spaces in front of ALL records in that field?
krankin
7 - Meteor
Hi.... no I just want to have the field padded to 12 characters. I working with a string field that is 12 characters and the values are 7 characters. PDMCU = '2382010'..... need to have ' 2382010'
krankin
7 - Meteor
This is what I have in the formula. padleft([NMCU],12," ")
estherb47
15 - Aurora
15 - Aurora

 @krankin 

 

 

Just like @Claje , I tried this and it worked for me. A few suggestions. First, make sure your text field is long enough to accommodate the spaces. A Select tool before the Formula tool can help with that.

 

The next suggestion is to add a browse tool, run the workflow, and check the results in a new window. Sometimes it's easier to see that way.

 

Let me know if that helps.

 

Cheers!

Esther

krankin
7 - Meteor
Hi again, I was expecting to see the result in the preview of the formula function. It doesn't seem to show the spaces there, but in my output, the Padleft with the spaces worked. Thanks!
estherb47
15 - Aurora
15 - Aurora

Hi @krankin 

 

Yes. The input arrow are the results prior to applying the formula. That's why I'm a fan of the Browse. You don't need to think about which side of the tool you're clicked on.

 

Cheers,

Esther

Labels