Dynamic data import / export


simply more productive
Up to 10,000 records can be processed with the freeware version!

Simple If-Then-Else example

Here we see a short and simple example of how a conditional branch is defined in practice, demonstrating the use of the If-Then-Else Heater.

All examples are contained in the FlowHeater ZIP archive downloaded and accompany the software as complete Definition files that can be opened directly in Designer.

What we want to achieve

If-Then-Else example
If-Then-Else example

This example inputs the following short CSV text file on the READ side:

1;first product;$10.50;10
2;second product;$20.56;4
3;third product;$33.66;14

The first field is the Product number, the second is the product Description, the third is the unit Price and the last field indicates the quantity remaining as Inventory. The first three fields are copied to the WRITE Adapter verbatim.

In this example we are only concerned with the Inventory field. If the Inventory is less than or equal to five, we want to write a notice into the field that the product should shortly be reordered.


If-Then-Else condition
If-Then-Else condition


The conditions are defined for the If Then Else Heater by using a double click on the Heater icon to open the properties window. In our case, we need only define one condition here. If the Inventory field contains a number greater than five (>5) then the field should be copied verbatim to the WRITE Adapter. However, if this is not the case and the value is less than or equal to five then the text "Inventory <= 5, product must be reordered" should be written to the Inventory field. Note: Since a numeric comparison of the incoming STRING data should be performed, the Change Data Type (INT) option is checked.



Here we have to use a little trick. Since the Inventory field is already connected to the If-Then-Else Heater as the first parameter, the value to be tested, we also need to insert a Clone Heater to replicate the Inventory value as the second If-Then-Else Heater input parameter, which is used to pass this value on when the condition is true.



The static text message stating "Inventory <=5, product must be reordered" is derived from an X-Value Heater as the third If-Then-Else Heater input parameter.



Tip: With a single click on the If-Then-Else Heater you can discover the input parameter sequence in Designer.