This deprecated node splits one input data set into two outputs based on a true/false condition that you define.
The simplest way to split your data is by using the Criteria grid in the PredicateExpr property. Alternatively, for more advanced techniques, you can use the Advanced tab.
If the input data meets the condition(s) that you have specified it will be listed in the first output pin (true), if the data does not meet the condition(s) that you have specified it will be listed in the second output pin (false).
Simple split
- Firstly, connect the Split node to a node that has run successfully to ensure that the input data is available.
- Select the Split node and view the Properties panel.
- In the Criteria grid of the PredicateExpr property, select a Field on which you want to base the split from the drop-down menu. You can type in the drop-down to filter the list of fields to those which contain the typed text.
- Choose an operator and specify a value.
The Criteria grid allows you to specify one or more split criteria groups. In the simplest case, you may wish to create just a single split criteria. However, if you specify multiple criteria, you can choose to Match all (AND in boolean logic terms), Match any (OR) or Match none (NAND) of these criteria in order to output a row of data.
By default, a single filter criteria group is created for you to populate. You can create further groups by clicking Add new criteria group. When you have multiple groups, you can then choose whether to Satisfy all groups or Satisfy any group in order to output a row from the input data set. This allows you to specify filter logic such as:
- Match all in group 1 AND Match any in group 2
- Match all in group 1 OR Match any in group 2 OR Match any in group 3
Basic example using the Criteria grid
You have the following input data to a Split node:
Product_Codeunicode | Product_Nameunicode | Payment_Methodunicode | Payment_Amountunicode |
---|---|---|---|
15 | Tea | Card | 1.2 |
2 | Coffee | Cash | 1.5 |
3 | Water | Cash | NULL |
15 | Tea_EarlGrey | Cash |
1.75 |
15 | Tea_Herbal | Card | 1.75 |
15 | Tea | Card | 1.2 |
You want to split off any records where the Payment_Method
is Card
:
- In the Criteria grid of the PredicateExpr property, select the
Payment_Method
field. - From the list of operators, select Equals.
- In the Value column, type
Card
. - Run the Split node.
All records that match the condition that you have specified, that is all records where the Payment_Method
is Card
, are output to the first pin (true), and the remaining three records where the Payment_Method
is Cash
are output to the second pin (false):
Output pin 1 (true)
Product_Codeunicode | Product_Nameunicode | Payment_Methodunicode | Payment_Amountunicode |
---|---|---|---|
15 | Tea | Card | 1.2 |
15 | Tea_Herbal | Card | 1.75 |
15 | Tea | Card | 1.2 |
Output pin 2 (false)
Product_Codeunicode | Product_Nameunicode | Payment_Methodunicode | Payment_Amountunicode |
---|---|---|---|
2 | Coffee | Cash | 1.5 |
3 | Water | Cash | NULL |
15 | Tea_EarlGrey | Cash | 1.75 |
To further modify the output, for example, to exclude the Product_Code
information, enter the following additional Script in the Script property and re-run the node:
emit *exclude Product_Code
In this case, the output of the first pin (true) would be as follows:
Product_Nameunicode | Payment_Methodunicode | Payment_Amountunicode |
---|---|---|
Tea | Card | 1.2 |
Tea_Herbal | Card | 1.75 |
Tea | Card | 1.2 |
Advanced configuration
If you wish to create a more complex split, there are several Script functions that you can use to return a true or false result. The following tables give an overview of some common operators that you can use within a Split or Transform node.
Comparison operators
Operator | Description |
---|---|
== | Equals |
> | Greater than |
>= | Greater than or equal to |
< | Less than |
<= | Less than or equal to |
!= | Not equal to |
+ | Add or plus |
- | Subtract or minus |
* | Multiply |
/ | Divide |
Logical operators
Operator | Description |
---|---|
not | Returns values that do not match the specified condition. |
or | Returns the Boolean value of true if one or more of the conditions is true. |
and | Returns the Boolean value of true if both of the conditions are true. |
Example using the Advanced tab
You have the following input data to a Split node:
Product_Codeunicode | Product_Nameunicode | Payment_Methodunicode | Payment_Amountunicode |
---|---|---|---|
15 | Tea | Card | 1.2 |
2 | Coffee | Cash | 1.5 |
3 | Water | Cash | NULL |
15 | Tea_EarlGrey | Cash |
1.75 |
15 | Tea_Herbal | Card | 1.75 |
15 | Tea | Card | 1.2 |
You want to split off any records where the Payment_Amount
is NULL
:
- Select the Advanced tab of the PredicateExpr property.
- Type:
Payment_Amount.isNotNull()
- Run the Split node.
All records that do not contain a NULL
value in the Payment_Amount
field (i.e. where the condition that you specified is true) are output to the first pin (true), and the Payment_Amount
record that contains a NULL
value is output to the second pin (false):
Output pin 1 (true)
Product_Codeunicode | Product_Nameunicode | Payment_Methodunicode | Payment_Amountunicode |
---|---|---|---|
15 | Tea | Card | 1.2 |
2 | Coffee | Cash | 1.5 |
15 | Tea_EarlGrey | Cash |
1.75 |
15 | Tea_Herbal | Card | 1.75 |
15 | Tea | Card | 1.2 |
Output pin 2 (false)
Product_Codeunicode | Product_Nameunicode | Payment_Methodunicode | Payment_Amountunicode |
---|---|---|---|
3 | Water | Cash | NULL |
Properties
PredicateExpr
The simplest way to split your data is by using the Criteria grid to select the field(s) that you want to split by. If the input data meets the condition(s) that you have specified in this property, it will be listed in the first output pin (true), if the data does not meet the condition(s) specified in this property, it will be listed in the second output pin (false).
Alternatively, for more advanced techniques, select the Advanced tab.
A value is required for this property.
Script
Optionally specify Script to further modify the split output, for example to exclude a specific field.
Inputs and outputs
Inputs: in1.
Outputs: true, false, multiple optional.