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.
Up to 100,000 records can be processed with the freeware version!
Flowheater Chart

Global Variables

More
13 years 8 months ago #2099 by Francis
Global Variables - Post(2099) was created by Francis
Hi again Robert!

I'm currently on a massive import of > 70 excels of the same frame that I'll handle with Forfiles command.

The problem here is that I have X rows ( random X ) for an information


ATA NAME DESCRIPTION


50 COMMUNICATION
LSA DESC A
ELT DESC B
COMPAS DESC C


75 CIRCULAR LOGIC
ALT DESC 1
GUI DESC 2



I need to create a row for each that contains each the '50' and '75' information in a certain field ATA.

Is there anyway to do this ?? I was thinking about global variable that changes everyime a new ATA is found, otherwise, the lastest value is took.


I joined an excel of the specimen so you'll be able to understand the request


Thanks ! And long life to your software !

Please Log in or Create an account to join the conversation.

More
13 years 8 months ago #2100 by FlowHeater-Team
Replied by FlowHeater-Team on topic Re:Global Variables - Post(2100)
Hi Francis,

I’ve made a simple example to explain this. Please have a look to the attachment dotnet_filter.zip.

The example uses the following .NET Script to remember the certain field ATA. If the field content is numeric, the ATA number is stored for the next and following rows.

NOTE: For the group header row the .NET Script heater returns an empty string!
Code:
string lastATA = String.Empty; public object DoWork() { string ata = (String)InValues[0].GetString(); if (ata != null) { if( IsNumeric(ata) ) { lastATA = ata; return ""; // we want to filter the first group header row! } } return lastATA; } private bool IsNumeric(string s) { int i; if (Int32.TryParse(s, out i)) return true; return false; }

In the next step, the ATA number form the .Net Script Heater are checked with the If-Then-Else Heater for the Condition

not equal 50 and not equal 75

In this case the Filter Heater filters the given rows. Only rows with ATA number 50 and 75 are passed.

If I’ve understand your request not correct please add your example data as a ZIP archive. Only ZIP files are allowed!

Attachment dotnet_filter.zip not found


Best wishes
Robert Stark

Please Log in or Create an account to join the conversation.

More
13 years 8 months ago #2101 by Francis
Replied by Francis on topic Re:Global Variables - Post(2101)
That's exaclty what I need !

But in your example, you hardcoded 50 and 75 in an IF heater. Is there a way to do determinate those run-time. I have to do it for 60 excels that I won't know each ATA number.

The logic is exactly what you posted as example, but with a mecanism group by ATA dynamically.

I don't know if you understand my request well ?? I'll post an example if not

Please Log in or Create an account to join the conversation.

More
13 years 8 months ago #2103 by FlowHeater-Team
Replied by FlowHeater-Team on topic Re:Global Variables - Post(2103)
The only way is to read the conditions form a file with a second .NET Script Heater.

Replace the If-Then-Else Heater with one more .NET Script Heater and copy the following script into it.
Code:
string [] sConditions = null; public object DoWork() { // Load conditions only first time if (sConditions == null) { sConditions = File.ReadAllLines("conditions.txt"); } // get the first input parameter string sCmp = (string)InValues[0].GetString(); if (sCmp == null) return true; // check all conditions foreach(string cond in sConditions) { if (sCmp == cond) return false; // false = no filter, pass this line } return true; // true = Filter this line }

The script read at start time the conditions dynamically from a text file "conditions.txt" in a global string array. Per each row the script check if the ATA number match each of one row form the text file.

I’ve modified the example with this script and have putted also the GroupBy Heater to the example.

If I've misunderstand you please describe a bit more what you want and send some example. Source format and destination format are helpful.

Attachment dotnet_filter02.zip not found


Best wishes
Robert Stark

Please Log in or Create an account to join the conversation.

More
13 years 8 months ago #2105 by Francis
Replied by Francis on topic Re:Global Variables - Post(2105)
Wow ! exactly this !

Global variables in imports are so useful, incredible !

Thanks again, you always have answers. This software has really no limits !

Please Log in or Create an account to join the conversation.

Time to create page: 0.283 seconds
FlowHeater Logo

FlowHeater - The Data Specialist

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

Legal information

Support & Contact

Contact

Phone:
0951 / 9933 9792

eMail:
This email address is being protected from spambots. You need JavaScript enabled to view it.


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