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

.NET Script Heater, dynamic .NET Script Code

Heater .NET ScriptWith the .NET Script Heater you can equip your FlowHeater Definition with your own .NET coding in C# or VB.NET. In principle, all the .NET functions provided by the .NET Framework 4.5 are available. This means there is now unlimited scope for building dynamic transformations.
Anything that you have so far not been able to achieve with the supplied functions, you can easily program in DOTNET yourself with the help of the .NET Script Heater. Both DOTNET programming languages C# (CSharp) and VB.NET (Visual Basic) are supported.

Note: Extremely extensive scripts can be employed. Even complex classes and own .NET DLLs can be included!

Settings

Script tab

Heater .NET Script - ConfigurationHeater .NET Script - ConfigurationRun at: The options available are as follows.

Start: The script is run once, when starting the processing step in which the Heater is present. If this option is selected, no values can be passed to the Heater, and the Heater has no output.

Standard: The script is called once each record, provided the output value is retrieved.

Per row/record: The script is called each row/record, regardless of whether the output value is retrieved.

End: The script is run once, at the end of the processing step in which the Heater is present. If this option is selected, no values can be passed to the Heater, and the Heater has no output.

Language: Select the desired programming language. C# (C-sharp) and VB.NET (Visual Basic) are available.

Check syntax: With this button you can check the script entered for possible errors.

Description: Enter some descriptive text here. This will be displayed as a ToolTip in the Designer when you hover the mouse over the .NET Script Heater.

Advanced tab

Heater .NET Script - Usings / ImportsHeater .NET Script - Usings / ImportsAbort processing if an error occurs: When this option is checked all processing is terminated if an error occurs in the script at runtime. Note: You should only deactivate this option for test purposes or when troubleshooting!

Using / Import: Enter any Using (C#) or Import (VB.NET) statements here that are required by the script.

DLLs: Enter all DLLs that need to be loaded before running the script. If you want to use your own DLLs, they must either be available in the Global Assembly Cache (GAC) or into the BIN directory of the FlowHeater installation. All DotNet DLLs from .NET Framework versions 2.0 to 4.5 are supported.


 

Library tab

Heater .NET Script - LibraryHeater .NET Script - LibraryYou have the option of storing scripts for later use in a script library as "Custom Script” Heaters. You can define the library path with “Menu->Extras->Options->.NET Script”. User scripts saved in this path can then be drawn into the Definition using the Designer just like integrated Heater/Functions.

Initials: Two characters that are displayed to distinguish the particular “Custom Script” Heater on the Designer workspace.

Display name: The name of the “Custom Script” Heater that is displayed in the selection area.

Save as: This button opens a “save file” popup window, allowing you to store the user script for later use. The library path mentioned above is predefined as the default path. Here you can group your user scripts into subfolders (only one level). The folder name is taken as the group name. To ensure that the same scripts are always used on different computers or in a team, the library path also supports UNC paths and network drives.

Amend script in library: An existing “Custom Script” Heater is opened, allowing you to make changes to the script and to save these changes to update the underlying script. Note: Only the underlying script is changed. Other Heaters that have already used an older script version remain unaffected!

 

Access to parameters and data type conversion

The .NET Script Heater makes use of the same mechanisms as FlowHeater itself. Incoming data types are automatically converted into the necessary data types according to the format settings on the WRITE Adapter. In order to make use of these, five functions are available.

 FunctionDescription
  object InValues[x].GetValue() Returns the raw contents of the parameter without conversion, you have to handle these yourself.
  object InValues[x].GetInt() Converts the contents to an Integer value.
  object InValues[x].GetLong() Converts the contents to an Long value.
  object InValues[x].GetBool() Converts the contents to a Boolean value.
  object InValues[x].GetDouble() Converts the contents to a Double value.
  object InValues[x].GetDecimal() Converts the contents to a Decimal value.
  object InValues[x].GetString() Converts the contents into a String.
  object InValues[x].GetDateTime() Converts the contents into a DateTime type.

Note: x = 0 is the first parameter


Warning: In all functions, if the return value is NULL then the contents could not be converted.

The heater parameters can be accessed using the InValues array with the methods listed above. The sequence of parameters is the same as defined in Designer.


Return value

The result of your own transformation function is delivered as a return value for further processing by FlowHeater. The following .NET data types can be returned at present.

  • null
  • bool
  • int
  • long
  • float
  • double
  • decimal
  • DateTime
  • string

Examples


or inspect the following short C# (C-sharp) Script code extracts for a brief introduction

Simple counter, returning 1, 2, 3, and so on… according to the number of records processed.

int i = 0;
public object DoWork()
{
     return ++i;
}

 

Extended counter including invocation of an additional function. Returning this time 2, 4, 6, and so on... according to the number of records processed.

int i = 0;
public object DoWork()
{
    return Calculate();
}

private int Calculate ()
{
    i += 2;
    return i;
}

 

A somewhat more complex calculation using an additional class, which processes the first heater parameter.

public object DoWork()
{
    object o = InValues[0].GetInt();
    if (o == null)
        return -1;
    else
    {
        ComplexCalculation complex = new ComplexCalculation();
        return complex.Calculate((int)o);
    }
}

public class ComplexCalculation
{
    public ComplexCalculation()
    {
    }

    public int Calculate (int i)
    {
        return i + i;
    }
}

 


Please also refer to the general information on the use of Heaters (functions)

 

FlowHeater Logo

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 / 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.