Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Import content of multiple txt files

KrisG
7 - Meteor

Greetings Alteryx community!

Making my first post here, as I am facing a challenge I have not been able to solve.

 

I have about 100 log files in TXT format with the following schema:

 

logfile.jpg

 

 

 

 

 

 

 

 

I need to import the contents of all these txt files to get an overview of the logs and the errors thrown ("Status reason"). I have messed around with the standard Input tool and the Directory tool but have not found a way to import all the contents and organize it in columns. All the files have the same scheme although things are slightly more complicated since the number of tabs varies. For instance there is just a single tab after "Excel generate time" but 3 tabs added after "CVR".

Does anyone have an idea on how to achieve this, so I can import and organize the contents of all these log files in columns? 
I am adding a couple of the log files for reference.

Thank you all

5 REPLIES 5
MarqueeCrew
20 - Arcturus
20 - Arcturus

@KrisG,

 

I have a workflow to share with you.  Here's my approach:

  1. Read Input with a wildcard to get all files
    1. Flat, no delimiter
    2. Keep filename
  2. Replace tab(s) with a single '|' pipe character
  3. Parse on PIPE
  4. Crosstab from columns to rows of data
  5. Reformat excel date so that @ 0 becomes @ 00:00:00
  6. Convert dates to ISO date formats
    1. Excel
    2. File End
    3. File Start
  7. Cleanup

Capture.PNG

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
jdunkerley79
ACE Emeritus
ACE Emeritus

How about the attached.

 2017-11-08_13-23-34.jpg

- Import the files as CSV with no separator (\0) and no headers

- Use a Regex tool to split into header and value:

(.*?):\t+(.*)

- Finally CrossTab to convert to columns 

-  And stealing from @MarqueeCrew idea,  a MultiField tool to parse the dates

MarqueeCrew
20 - Arcturus
20 - Arcturus

@jdunkerley79,

 

While faster/fewer tools, I thought that I would be explicit and use a simplified toolset.  In your solution, you'll still create underlines instead of spaces in field names and the excel date field is in a different format from the other dates.

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
jdunkerley79
ACE Emeritus
ACE Emeritus

Date format looked the same to me (dd//mm/yy @ HH:MM:SS).

Agree on the underscores I always forget that and drives me batty on it :)

 

No objections to the simpler tools - personal preference. As always in Alteryx more than 1 way to do things!

KrisG
7 - Meteor

Thanks a lot for both of the solutions, I will dive into them and learn from them both :)

 

@MarqueeCrew I just ran your flow and it gives the result I needed. I did get several field conversion errors that seem to be related to the date input and format (we use DD/MM/YY) and also the Danish ÆØÅ characters is causing a bit of trouble, so I will try to look into that.

 

Thanks again for your time and effort!

Labels