-
Tim
-
Topic Author
-
Offline
-
Posts: 3
-
-
|
Hi,
Is it possible to use part of the READ filename as a parameter?
EG the READ file name is 123456FFTT.txt and I need to use the 123456FFTT as a value for a GET parameter.
Hope that makes sense.
thanks
|
Please Log in or Create an account to join the conversation.
|
-
FlowHeater-Team
-
-
Offline
-
Posts: 391
-
-
-
-
|
Hi Tim,
You need the
.NET Script Heater
and one of the following Scripts below. What script you need depends on the Adapter you use (
Excel
or
TextFile
).
Move one .NET Script Heater on the
Designer
. Put the desired script into and connect the output to the
Parameter Heater
, that’s all.
Script for the TextFile Adapterpublic object DoWork()
{
// Get the Textfile Adapter on the READ side
TextFileAdapter adapter = (TextFileAdapter)AdapterRead;
// return only file name without path and extension
return Path.GetFileNameWithoutExtension(adapter.Filename);
}
Script for the Excel Adapterpublic object DoWork()
{
// Get the Excel Adapter on the READ side
ExcelAdapter adapter = (ExcelAdapter)AdapterRead;
// return only Excel workbook file name without path and extension
return Path.GetFileNameWithoutExtension(adapter.Workbook);
}
Best wishes
Robert Stark
Did this answer your question? We would be grateful if you provide a brief comment as feedback. It may also help others who may have encountered a similar problem.
|
Please Log in or Create an account to join the conversation.
|
-
Tim
-
Topic Author
-
Offline
-
Posts: 3
-
-
|
Perfect !!
Exactly what I was after.
I've got to say what an excellent bit of software this is.. this has saved me literally a week of work !
If only our ERP system was the same value for money
|
Please Log in or Create an account to join the conversation.
|
-
Tim
-
Topic Author
-
Offline
-
Posts: 3
-
-
|
Hi Robert,
One more question.. I'm using the TextFileAdapter and this is working perfectly, however there is a couple of lines at the end of the file that I don't want to process. ( i.e. it's footer information I don't need )
The first line in the footer section always begins with the letter T and I want to drop every line after that. I tried adding this to the .Net heater to filter out but it stopped the first bit working.
I then tried IfThenElse and this sort of worked but only for the line starting with T not the following lines
Is there a way to do this
thanks
Tim
|
Please Log in or Create an account to join the conversation.
|
-
FlowHeater-Team
-
-
Offline
-
Posts: 391
-
-
-
-
|
Hi Tim,
This you can do with the
Filter Heater
together with the
.NET Script Heater
and the following script below.
Connect your first filed with the .NET Script Heater. The output you have to connect to the Filter Heater. The Script check if the first character is T or t and this an all following line will be filtered.
bool bFilter = false;
public object DoWork()
{
if (bFilter == true)
return bFilter;
if (InValues.Length != 1)
throw new ArgumentException(".NET Script Heater: one input parameter expected!");
// Get the first input parameter
string sValue = (String)InValues[0].GetString();
if (sValue != null && sValue.Length > 0)
{
if (sValue[0] == 'T' || sValue[0] == 't')
{
// if the first letter equal to T or t this line an all following lines will filtered
bFilter = true;
}
}
return bFilter;
}
In one of a next version I'll implement a new Stop Heater. With this Heater/Function you can stop the import/Export process with the help of the IF-THEN-ELSE Heater and a simple condition.
Best wishes
Robert Stark
Did this answer your question? We would be grateful if you provide a brief comment as feedback. It may also help others who may have encountered a similar problem.
|
Please Log in or Create an account to join the conversation.
|
Time to create page: 0.199 seconds