I have daily data come in and need to make one of the columns the filename. i.e. reach record in the table would have "todaysfile_02162015.txt" or whatever the file name is. I can use "Field Info" to get the filename but then I can't link it back into the data so that every record has the filename. Note: it's the same filename for all the records.
Solved! Go to Solution.
Yep! that works perfectly. I just need to come up with the right RegEx pattern, which is not straightforward.
But, this is great!
Thanks @mbarone
Welcome!
What is the string you want to parse, and what to want the result to look like?
Here is the string::
File: odbc:DSN=SuteBackups|Select netsuite_2015_m09_d21__10_07_s32.OPPORTUNITIES.* From netsuite_2015_m09_d21__10_07_s32.OPPORTUNITIES
and I need to parse it to:
2015-09-21
Appreciate that.
Ah. There's probably a million ways to do that, but I'd do it quick and easy and use a text to columns tool delimited by the underscore, with only three or four columns. On the field with the m## and d## just take the right 2.
Sounds like a great approach. I just implement it and works fine ;)
Thanks again.
Sure thing!
How could the filename be extracted within a dataflow in order to insert into a filename field and / or part of the filename parsed as a new field value. I am using the Directory input tool in order to 'loop through' multiple files and process various data / schema within the workflow and want to input the filename as a field value and part of the filename as field for all records processed.
For each file you're looping through - are you reading in the data with a Dynamic Input tool? In the configuration for the Dynamic Input tool template, you can select to add the file name to the data, just like you can in a regular Input Data tool.
Right. And you also have to give the Dynamic Input tool a sample file/template by clicking Edit:
And that causes a pop up that is the same as the configuration of a regular Input Data Tool, where you can bring in either the full path or just the file name as a separate field: