◷ Reading Time: 4 minutes
In this tutorial, we want to find the common cars in two groups of Model and Make of cars.
We expect to see the list below:
- Ford Pickup
- Ford T
- Ford Taurus
- Hyundai Santa Fe
Input and Output
In an IRD we can define as many as inputs and outputs as required, then we connect different data sources to inputs and the network/graph of operators will navigate these to the output results.
In this example, we are going to have one input (list of cars) and two outputs (command and all unique cars).
There are many different data operators pre-built into IRD (i.e., Group, Filter, Select, Minus, Union, Intersect, etc.). These can be used as many times as required. All operators must be connected to a source of information.
In the first step of this task we need to separate the cars into two groups by “Group” value. So let’s select Group operator from toolbox and add it to our model:
There are two types of associations between any node in an IRD:
These pass data/information to the next nodes either ‘as is’ or process them further before passing. As mentioned previously, all operator nodes, must have a source. If the source of a node comes from another node, it is an Information association. Otherwise it is a Knowledge association. Knowledge allows the result of a node (operator) to be passed to other nodes as known information. This will be shown in the next section.
In an IRD you can have as many as operators that you need to navigate to the output nodes. In this example, the result of the group has two lists based on “Group” value. Let’s select ‘Make’ and ‘Model’ from each:
Select node requires a list of properties in order to select them. That is in the “Parameters” part of the properties window. Once you have added the select nodes, in the properties window you will see parameters:
Then add the two following parameter values:
You will then have the result shown below:
Once you press the “OK” button, the properties window will be refreshed:
You need to repeat this for both Select nodes.
For common cars, we just need to find the commonalities in each selection, so we use the Intersect operator and connect each select node to that. This then becomes the answer to ‘common cars’.
This is part of a more complete sample called “Collections” when you install FlexRule Designer. Once you open the Collections project, then open a document called Cars-IRD.xml. You can then use the prepared logic run template to feed sample data to the model and see it in action.
Once execution is finished, you will see the results below using data viewer: