Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Remove special characters - different excel files except slash (/) in dates

PassION_es
10 - Fireball

Hello Alteryx Team,

 

I have a workflow that converts excel file to .dat extension format using csv.  The workflow already generate an output in .dat format however, it does not have yet cleanse the output. I need some help in the cleanse tools or any tool that will remove all special characters except to dates with /slash (date format is 01/01/2000) and except for period inside the amount (ex. 500000.25).

 

I only use cleanse tool when column headers are there.  However, in this case, the excel file has no header that is permanent and the first row contains data that is dynamic, changes every month. 

 

The question is, are there any tools other than cleanse tool that eliminates all special characters captured in excel file whatever data or number of columns/fields the excel file has as long as the slash(/) in all dates are retained? Also, is it possible to use one workflow to various excel files with different number of columns or different data set? We have different files that need to be converted from xlsx to .dat extension file and all these files may have different columns and dates are located in one or 2 of these columns.

 

Attached is the dummy input (excel) and workflow for your reference.  Thank you in advance.

 

 

33 REPLIES 33
PassION_es
10 - Fireball

Hi @binuacs , need your assistance again.  I am trying to add "apostrophe (') in the regex formula as one of the characters to be removed but I am getting error when inserted that charcter to the regex formula. 

 

current regex:

PassION_es_0-1669121157079.png

 

regex error when I try to include ('):

PassION_es_1-1669121240012.png

Also can we add in the regex or  replace Ñ as N?  Thank you.

binuacs
21 - Polaris

@PassION_es use the below regex formula to remove the character '

 

IIF(REGEX_Match([Value],'\d+\/\d+\/\d{4}'),[Value],IIF(REGEX_Match([Value],'\d+\.\d+'),toString(toNumber([Value]),2,0),IIF(REGEX_Match([Value],'\d+\/\d{4}'),[Value],ReplaceChar([Value],"/'.,*!;",''))))

 

binuacs_0-1669156757739.png

 

binuacs
21 - Polaris

@PassION_es for the second question you can use the ReplaceChar() function like below

 

binuacs_1-1669157114213.png

 

PassION_es
10 - Fireball

Thank you @binuacs , it validated successfully now.

Labels
Top Solution Authors