Skip to main content
simply more productive

The Data Specialist

Thanks to our intuitive transformation designer, you can convert data effortlessly to a variety of formats without knowing how to program. It’s not only efficient, it’s also easy to use.
Flowheater Download

Use part of READ filename as parameter

More
12 years 4 months ago #2189 by Tim
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 to join the conversation.

More
12 years 4 months ago #2190 by FlowHeater-Team
Replied by FlowHeater-Team on topic Re:Use part of READ filename as parameter
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 Adapter
Code:
public 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 Adapter
Code:
public 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 to join the conversation.

More
12 years 4 months ago #2191 by Tim
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 to join the conversation.

More
12 years 3 months ago #2192 by Tim
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 to join the conversation.

More
12 years 3 months ago #2195 by FlowHeater-Team
Replied by FlowHeater-Team on topic Re:Use part of READ filename as parameter
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.
Code:
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 to join the conversation.

Time to create page: 0.349 seconds

FlowHeater - The Data Specialist

Efficient data integration and transformation with FlowHeater – the perfect solution for a seamless transfer of your data.

Rechtliches

Support & Contact

Kontaktinformation

Telefon:0951 / 99339792 E-Mail:This email address is being protected from spambots. You need JavaScript enabled to view it.

Copyright © 2009-2024 by FlowHeater GmbH. All rights reserved.