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!
Solved! Go to Solution.
What do you have as your "Quote Output Fields" setting? Changing this to Never should fix it for you.
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 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.
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?
@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.
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.
Thank you, Brandon, for all the clear and useful explanations.