ALTERYX INSPIRE | Join us this May for for a multi-day virtual analytics + data science experience like no other! Register Now

Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

Regex Parsing as .flat file

Istwineres
8 - Asteroid

Hi, I'm looking for a solution for this problem. I've got a .txt file where the first 3 fields are all the same length (9 characters,1 character, 9 characters), if the second field is equal to 1 then I should use a .flat file to map the field otherwise I should use another .flat file. I was wondering if using a filter tool on 2nd field and then apply a regex to map the field could be a solution to my problem. The file does not contain punctuation only letters, numbers and space: 

00001CA LNP11850F00000000000000000000000030400 00000000000 TJGJIEE EGEGES 5P11I850F00000000000

 

Many thanks!

mbarone
15 - Aurora
15 - Aurora

Hard to understand without seeing an actual example of what you're talking about, but it sounds to me like you can filter on that 2nd field (using a substring formula) equaling 1 or not.  And then have the T node of the filter tool going to one Dynamic Input tool, and the F node going to another Dynamic Input tool (both of which will have their respective flat file configs).

Istwineres
8 - Asteroid

I'm afraid your solution doesn't work, the dynamic input tool requires an action on data source that a simple filter tool cannot provide

mbarone
15 - Aurora
15 - Aurora

Right, you'll have to bring in the full path of the file from your source file and feed that into the Dynamic Input tool.  Check out the Tool Mastery Series on the Dynamic Input tool.

Istwineres
8 - Asteroid

If I have to read again the file, the filter at the beginning of the workflow wouldn't make sense. This approach is not helpful

apathetichell
13 - Pulsar

Are you just looking to see if the 10th character is equal to 1? I'm sorry I can't tell from the data you posted if there are separators or breaks in the 9/1/9 character sequence.

 

- and also are the lengths set?

Istwineres
8 - Asteroid

The length are set after the initial sequence (9/1/9)  I'd like to simulate a .flat file when importing the file with a regular expression

Labels