I am trying to setup a job in FME that reads a CSV file where the filename changes daily. The filename looks like this HHSVENDORS_02242020.txt. The HHSVENDORDS_ is always the same, but then it has the date appended in the format MMDDYYYY. Is there a way to dynamically create/read the input filename on a CSV reader? So when the job runs each evening, it will pull the correct file.
There are a couple of ways to do this, either via a scripted python parameter or using a featurereader to read the CSV file instead of a standard reader.
For the featurereader route, a creator can be used to start the workspace, followed by an attributecreator to create the filename using Date/Time functions. Then you can use this as your filename in a featurereader.
The above example assumes you always want yesterday's date, rather than today's date
There are a couple of ways to do this, either via a scripted python parameter or using a featurereader to read the CSV file instead of a standard reader.
For the featurereader route, a creator can be used to start the workspace, followed by an attributecreator to create the filename using Date/Time functions. Then you can use this as your filename in a featurereader.
The above example assumes you always want yesterday's date, rather than today's date
Thank you @ebygomm. This is extremely helpful! I added the AttributeCreator and believe I have it correctly configured. I'm very new to FME and have another quick question please - I don't have that CSV output on my FeatureReader as you show (which I need to pass into a SQL Executer). How do I get/configure that FeatureReader for that? Below are my settings.
I keep getting this when I click OK and not sure what to put here or just click Cancel?
Thank you again!
Thank you @ebygomm. This is extremely helpful! I added the AttributeCreator and believe I have it correctly configured. I'm very new to FME and have another quick question please - I don't have that CSV output on my FeatureReader as you show (which I need to pass into a SQL Executer). How do I get/configure that FeatureReader for that? Below are my settings.
I keep getting this when I click OK and not sure what to put here or just click Cancel?
Thank you again!
If your csv files are all the same, in the Generating Output Port box just choose one of the existing CSV files that has the correct attribute names and it should generate the CSV output port. If you don't get the CSV output port you may need to change the parameters of the reader to Feature Type name From Format Name:
If your csv files are all the same, in the Generating Output Port box just choose one of the existing CSV files that has the correct attribute names and it should generate the CSV output port. If you don't get the CSV output port you may need to change the parameters of the reader to Feature Type name From Format Name:
Thank you @ebygomm This all worked perfectly!