Alteryx Designer Desktop Discussions

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

How to represent a string with 60 characters?

jpscoralick
8 - Asteroid

Hello everyone!

 

I need to convert my .xlsx file to .txt. Before this step, I must handle several columns. 

One of them contains a string that has values like these: "ACB", "ASDR" etc.

I need to represent them with 60 characters, like this: "ACB                                                       ", I mean, "ACB" followed by 57 blank characters.

I've tried this with Formula Tool: PadRight([My_Column], 60, " "). The result in .txt file shows what I expected, but also includes a " character both at the begining and the end.

 

Could someone help me?

Thanks in advance!

6 REPLIES 6
BrandonB
Alteryx
Alteryx

What do you have as your "Quote Output Fields" setting? Changing this to Never should fix it for you. 

 

BrandonB_0-1658170755823.png

 

jpscoralick
8 - Asteroid

Hello, Brandon!

 

It worked for removing the " charcater from the result. 

However, by choosing "Never", Alteryx prohibits me to use a Delimeter for my .txt file. Once I'm saving it as a .csv file and renaming it as .txt, all the fields keep getting separated by a comma, as shown bellow:

 

jpscoralick_1-1658171525962.png

 

BrandonB
Alteryx
Alteryx

@jpscoralick that's because the no delimiter actually requires you to specify \0 which means no delimiter instead of just an empty delimiter box. A little strange, I know! But that should take care of it for you. 

jpscoralick
8 - Asteroid

Thank you so much! It works so well now.

 

If is it possible, one last question, please: does using PadRight/PadLeft is the best way to handle with representing a String with a certain total of characters?

BrandonB
Alteryx
Alteryx

@jpscoralick that is normally the approach that I take as well. PadRight in this scenario will ensure that each string is the specified number of characters and pad the strings with the specified character. 

 

BrandonB_0-1658176090914.png

 

 

Keep in mind, however, that PadRight does not serve as a truncation feature, so if you could potentially have values longer than you would expect you might also want logic to account for that like using Left([String], length) to ensure that nothing is longer than expected. 

 

jpscoralick
8 - Asteroid

Thank you, Brandon, for all the clear and useful explanations. 

Labels