Skip to main content
Solved

How do I read a .log file from a directory and transform it into an excel file?


fbastian73
Contributor
Forum|alt.badge.img+12

Hello FMErs,

I am wanting to read a .log file from a specific directory, run it pass a tester on a specific attribute and then output the result in excel file format. I plan to place this on the server for self serve.

example file attached. I had to change the file extension to .txt due to attach rules.

suggestions?

thanks in advance.

Best answer by redgeographics

Use a Directory and File Pathnames reader to read that directory, make it retrieve the file properties. This includes the attribute path_modified_date, use a DateTimeConverter to change that into a FME Datetime (without offset), a Sorter to sort on that (descending, numeric) and a Sampler to grab the first 2 features. That'll be the 2 most recently modified files in that directory. Then use a FeatureReader, set to CSV, to read them, if you set that up just like @gio suggested you should be good.

View original
Did this help you find an answer to your question?

3 replies

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • October 5, 2018

You can read the log file with csv reader and use the pipe (the vertical line) as delimiter. No need to change the extension for that, just choose csv reader format.

The attributes wil be created.

Then work from there.


fbastian73
Contributor
Forum|alt.badge.img+12
  • Author
  • Contributor
  • October 6, 2018
gio wrote:

You can read the log file with csv reader and use the pipe (the vertical line) as delimiter. No need to change the extension for that, just choose csv reader format.

The attributes wil be created.

Then work from there.

Thanks gio,

 

thats a start.

 

I need to get the CSV reader to read from the directory the 2 lattest files published there.

 

I have attached a screen shot to give an idea of the requirement.

 

thank you.capture.png

 


redgeographics
Celebrity
Forum|alt.badge.img+49
  • Celebrity
  • Best Answer
  • October 8, 2018

Use a Directory and File Pathnames reader to read that directory, make it retrieve the file properties. This includes the attribute path_modified_date, use a DateTimeConverter to change that into a FME Datetime (without offset), a Sorter to sort on that (descending, numeric) and a Sampler to grab the first 2 features. That'll be the 2 most recently modified files in that directory. Then use a FeatureReader, set to CSV, to read them, if you set that up just like @gio suggested you should be good.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings