Solved

I've set up a File Watcher but I can't figure out how to manipulate the output before copying the file out


Hi All, the attached screenshot explains a lot so might want to check that out first. My problem is that I have successfully set up a homemade 'file watcher' where we can drop various files into one folder to be sorted and moved to their correct folders. All this is doing is saving a lot of manual drag and drops but there's a lot of them so it's quite useful (if I can get it to work).

 

As you can see in the screenshot, the first 4 files sorted just get copied back out and that works perfectly. The 5th, an xls file called 'covid vaccine data', needs to be read in and the records written back out as a csv before being copied elsewhere. You can see that I attempted to use a Feature Reader but the records come out blank so the writer at the end writes out 1,274 blank rows. Any idea how to make this work so I can get that file, read in the actual data, and write it back out? It feels like I'm close but it sure isn't working yet :)

 

Thanks in advance,

Ian

icon

Best answer by nielsgerrits 29 April 2022, 16:53

View original

2 replies

Userlevel 6
Badge +32

Multiple ways to do this:

  • Add an AttributeExposer Downstream the FeatureReaders Generic Output port. Set these attributes in the FeatureWriter. I use this when the input is static. (Same column names for different files.)
  • Also connect the FeatureReaders <Schema> Outputport to the existing FeatureWriters inputport. In the FeatureWriter, enable the "Dynamic Schema Definition" checkbox. Under tab User Attributes, set the Attribute Definition radiobutton to Dynamic and remove all attributes. I use this when the input is dynamic. (Different column names for different files.)

yup, @nielsgerrits​ that got it! Connecting the AttributeExposer to the Generic Output Port and using schema from one of the files allowed me to use an excel writer to get the file out to a new location. So now I have a filewatcher/manipulator :)

 

Thanks!

Reply