get current read filename
- FlowHeater-Team
- Topic Author
- Offline
- Admin
Less
More
11 years 8 months ago #2279
by FlowHeater-Team
Best wishes
Robert Stark
get current read filename - Post(2279) was created by FlowHeater-Team
Hi,
I very often need to use parts of the current input filename inside the logic of the transformation. Mostly the file might actually contain a date that has some significance and that I would need to parse out and use in the output. I assumed maybe a "global" parameter to be available (since I am calling via the Batch interface and I use the //ReadFileName [file] command line to pass in the file I need to process). Is this ReadFileName visible somehow, to be used? And if yes - could you maybe give a quick explanation?
Thank you.
Heinz
Request via email
I very often need to use parts of the current input filename inside the logic of the transformation. Mostly the file might actually contain a date that has some significance and that I would need to parse out and use in the output. I assumed maybe a "global" parameter to be available (since I am calling via the Batch interface and I use the //ReadFileName [file] command line to pass in the file I need to process). Is this ReadFileName visible somehow, to be used? And if yes - could you maybe give a quick explanation?
Thank you.
Heinz
Request via email
Best wishes
Robert Stark
Please Log in or Create an account to join the conversation.
- FlowHeater-Team
- Topic Author
- Offline
- Admin
11 years 8 months ago #2280
by FlowHeater-Team
Best wishes
Robert Stark
Replied by FlowHeater-Team on topic Re:get current read filename - Post(2280)
Hello Heinz,
For obtaining the current READ file name into the transformation you need the help of the .NET Script Heater and the little script below.
You have to move just one .NET Script Heater on the Designer. Double-click on the Heater and replace the default script with the Script above. The .NET Script Heater returns now the current file name.
For obtaining the current READ file name into the transformation you need the help of the .NET Script Heater and the little script below.
Code:
public object DoWork()
{
// get access to the READ TextFile Adapter
TextFileAdapter adapter = (TextFileAdapter)AdapterRead;
// return the filename for further processing
return adapter.Filename;
}
You have to move just one .NET Script Heater on the Designer. Double-click on the Heater and replace the default script with the Script above. The .NET Script Heater returns now the current file name.
Best wishes
Robert Stark
Please Log in or Create an account to join the conversation.
Time to create page: 0.249 seconds