If-Then-Else Heater,defining conditions
With the IfThenElse Heater you can enter conditions or decision-making into your Definition. This Heater can handle up to three inputs, but at least one input must always be given. If only one input is assigned, a Boolean value (TRUE or FALSE) will be returned. This is primarily used with the Filter and GroupBy control structure Heaters.
First input = IF : the input that will be resolved as a condition
Second input = THEN : return value if the condition is resolved as TRUE. This input is optional. If no second input is given, a Boolean value is returned.
Third input = ELSE : return value if the condition is resolved as FALSE. This input is also optional.
Warning: The format of the values you specify in comparative conditions must comply with the locale format of the WRITE Adapter. Take a number entered here as 100,12 for example. This would be interpreted as a decimal number of just over 100 with a German locale on the WRITE Adapter, but in the case of a USA locale the comma would ignored and it would be interpreted as 10012 (ten thousand and twelve).
Changing data types: This way you can specify that the Heater should interpret the incoming value as a different data type. For example, you have a string value that contains numbers. If you want to specify a condition of < 5 (less than five), then only strings where their first character is less than the character code of "5" would apply and this would include strings of numbers such as 12, 23, 34, 46 and 134. If you actually want to compare using the numeric value of such strings, you must set the change data type option to active and select a numeric FlowHeater data type (INT, DECIMAL or CURRENCY).
Ignore upper/lower case: This option instructs the IF-THEN-ELSE Heater whether strings comparisons should be case sensitive or not. For example, if this checkbox is checked, then the following two strings will be regarded as the same.
The condition for the IF clause is defined here. The condition may comprise as many comparisons as you wish. They are defined in a list here and the individual comparisons are combined together with the Boolean operators AND or OR.
Using the combo box "Value->" you can enter with what the incoming value should be checked or compared. When the combo box contains "Value ->" you can enter manually in the text field beside it the value to compare. Alternatively, to a comparison value there are four specific checking types available.
- IsNull, tests for the database value NULL (DBNULL)
- IsEmpty, checks whether the value is empty or has no content
- IsNumber, checks whether the value is numeric
- IsDateTime, checks whether the value contains a date and/or time
Note: The check for IsEmpty includes the check for database NULL value (IsNull) and also checks whether the incoming value consists of withespace characters . For these additional specific checks you can only use the comparison operations "= equal" or "!= not equal".
The actual condition settings result in the opposite result when you select the “Negate effect” option. This effectively enables conditions such as “Value does not begin with” and “Value does not end with.”
The following comparison operators are available:
= equal to
!= not equal to
< less than
> greater than
<= less than or equal to
>= greater than or equal to
** InString compare: tests whether the characters that follow are found somewhere in the string
!* InString compare: tests whether the characters that follow are not found anywhere in the string
=* Value begins with
*= Value ends with
The following examples illustrate uses of the IfThenElse Heater
- Simple If-Then-Else example
- Complex If-Then-Elseif .. Else example; an alternative and considerably more elegant method is also introduced here using the .NET Script Heater
- Excel CSV data export