Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Add multiple blank spaces between a string

mzlee
7 - Meteor

Hello, I am looking to concatenate columns into one string but I also need to format it with multiple spaces in between 

 

Example:

 

Column 1         Column 2            Column 3

2835                    2900                  0000A2

 

I need the string to look like below, having a fix amount of blank spaces in between:

 

2835         2900                 0000A2  

 

thx!

6 REPLIES 6
Deano478
12 - Quasar

@mzlee How many fixed spaces do you need?

 

Luke_C
17 - Castor
17 - Castor

Hi @mzlee 

 

Assuming you're outputting to a fixed width file you could try something like this with the padright function:

 

padright(tostring([Column 1]),14,' ') + padright(tostring([Column 2]),21,' ') + [Column 3]

 

This thread may also help you: https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/Create-a-fixed-width-output-us...6

 

image.png

mzlee
7 - Meteor

I need 6 fixed spaces between Column 1 and Column 2, and 10 fixed spaces between column 2 and Column 3

Luke_C
17 - Castor
17 - Castor

Hi @mzlee 

 

Is that 6 and 10 no matter the length of the data in the column originally?

mzlee
7 - Meteor

Hi Luke,

 

Yes, should be a fixed length as well of 30 characters. Sorry for not adding that information on my initial question!

Luke_C
17 - Castor
17 - Castor

@mzlee 

 

This should work assuming columns 1 and 2 are always 4 characters. padright(tostring([Column 1]),10,' ') + padright(tostring([Column 2]),14,' ') + [Column 3]

Labels
Top Solution Authors