Alteryx Designer Desktop Discussions

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

How do we output a fixed width delimiter file?

caltang
17 - Castor
17 - Castor

The extension of the file output is .LI6, the base can be read by Notepad++. 

The file has around 10 columns, but the length of each is not all consistent and it is delimited by varying space. 

Example data, “|” indicates a split in column on Alteryx: 

 

A | B | C | D | E

1230E | 20231031 | B | HSE | GHI-123456

 

The data is similar to the above for about 10k records. Now the spacing between A and B is 1 space, B and C has 3 spaces, C and D has 5 spaces, whilst D and E had 2 spaces. 

How can we achieve this? Looking to learn!

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
6 REPLIES 6
binuacs
20 - Arcturus

@caltang Do you have the expected output based on the above input to have a better understanding of your request? 

apathetichell
18 - Pollux

@caltang for fixed width - it's good to have a padright() function (usually in a batch macro) and you can feed in the column names and the needed width.

caltang
17 - Castor
17 - Castor

Hi @binuacs here is a sample output. Good point, I forgot to add that there can be some scenarios where certain columns are null, and this is not standard as well. Any pointers?

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
caltang
17 - Castor
17 - Castor

Hmm, okay @apathetichell  - I will try that out myself. Though I am concerned about the random nulls that can exist in column, then this would mean I need to account for the max length of each column, and if a column is null, then I will need to make the padleft/right dynamic as well.

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
apathetichell
18 - Pollux

@caltang - there are no nulls with a fixed width files - every non-entry is just space/spaces - and your padright() will pad the nulls with the full value of spaces.

 

and my take is that a fixed width file is that there is a max mapping (ie column a/x characters... column n/n characters) - this mapping is fed into the batch macro and is applied to the relevant column...

 

admittedly - doesn't have to be a batch macro - you could transpose and then match [Name] vs a column size mapping - apply your padding and and then crosstab.

caltang
17 - Castor
17 - Castor

Your way did it my friend! Thanks @apathetichell 

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
Labels