Configuring matching rules is in many cases a central part in the set up of a matching process. You often need to create only one set of matching rules. I.e., the default rule set. But, in Duco, you can also create multiple rule sets. You may want to do this for several reasons. For example:
- You simply want to organise your rules in distinct logical groups.
- You want to apply a set of rules to some records, but not to all records. You can associate a condition to a rule set to achieve this.
- You want to set up a multi-pass process, where you want to apply different rule sets to different passes.
Using rule sets to organise your rules
Sometimes you may want to create multiple rule sets simply to keep different types of rules organised in distinct logical groups, rather than keeping them all in the default rule set.
The image below shows a matching process where, besides the default rule set, four more rule sets are defined. The rule sets are: "Futures (Europe)" to hold rules related with futures trades traded in Europe, "Options (Europe)" to hold futures trades traded in North America, etc.
In a simple single-pass process, if you don't associate a condition with a rule set, the rule set is always applied.
Conditional rule sets
Rule set conditions enable you to apply rules to only some records instead of all of them, for example: different tolerances depending on a currency, ignoring fields depending on trade type, and so on.
Imagine you need to match the following data:
As you can see, some of the records in Data Set A indicate Price and Amount in Pounds (GBP) and some other records in Pence (GBX). In Data Set B, Price and Amount are always indicated in Pence (GBX). One way in which Duco can handle a situation like this is using a conditional rule sets.
In a simple single-pass process...
- If there is not a condition associated with a rule set, the rule set is always applied.
- If there is a condition, the rule set is applied for the records that satisfy the condition.
We are going to set up a process in the following way:
- Set up data inputs as usual
- Match all fields, except currency
- Create a rule set that applies only when the currency is "GBP". I.e., a conditional rule set.
- In the conditional rule set, associate a "multiply" rule to the Price and Amount fields to multiply "x 100" the value in Data set A
Let's get started:
- Set up data inputs as usual
- Align all fields, except currency
We are leaving out Currency fields because the conditional rule set that we are about to create effectively converts GBP to GBX,
Now create a rule set.
- Click Settings → Rules & Rule sets
- Click Add
- Enter a name for the rule set. E.g., "GBP to GBX"
- Click Create
As the image below shows, a new rule set called "GBP to GBX" has been created. Also note that now we have two rule sets: the "Default Rules" and the newly created "GBP to GBX".
We did not add any rule to "Default Rules", which is OK. We don't want any particular rule to be applied by default. We want instead to define a condition for the "GBP to GBX" rule set and add some rules that are applied only when the condition is met.
- Click on Add Condition
You can use the drop-down menus to form a condition. A condition is just a rule. Like any other rule, you can form it using Duco's drop-down menu system.
- Click Something is equal to something
- On the drop-down menu on the left side, click A field → From Data set A fields, Currency
- On the drop-down menu on the right side, click Some text → Enter "GBP"
- Click Save
The image below shows the resulting condition.
Now we need to add some matching rules.
- Click add rule next to the "Amount" field
- Select the Multiply rule
- Enter "100" in the next box, to multiply the field value by 100.
- Click on Save
The image below shows the resulting rule.
- Create in the same way a "multiply X 100" rule for the "Price" field.
We can now run the process.
- Click Process → Overview
- ... and then click New Run → Run with previous data
Among the Matched results you should find results like the following:
As you can see, the values in the element "Price" match because 34.29 x 100 = 3,429. Similarly, the values in the element "Amount" match because 67,894.2 x 100 = 6,789,420.
If you look at the Partial Matches results, you should see some results something like the following.
The value 19.41 x 100 = 1,941, which is still different from 1,940.5. If you want to remove these partial matches, we'll need to add a tolerance rule.
If you run the process after adding the tolerance rule, you should see results as in the following screen.
The logic behind conditional rule sets
Rule set conditions apply per side - they work like "tagging" a column as ignored. The matching engine is strict - it considers the value of the cell separately to the ignored-ness. Two items may be identical, but if one is ignored, it'll cause a break because the ignored tag is different on both sides. The use of the "Optional" rule can fix this problem, as it allows ignored things to be compared to non-ignored things.
Rules in a multi-pass process
In a multi-pass process the relationship between passes and rules is as follows:
- The default rule set applies to each pass
- Other rule sets need to be assigned explicitly to passes.
- A rule set applies only to the passes to which it is assigned. If this rule set has a condition, it is applies only to the records that satisfy the condition.
What happens if you create a rule set and don't assign it to any pass - i.e., you have an "orphaned" rule set? Duco does not apply it. When the process runs, the rule set is ignored. Keeping a rule set temporarily orphaned may be useful while configuring a process. It is also something that is best to avoid in a fully configured process, because it is likely to confuse someone maintaining the process configuration.
From the Roll-up rules drop-down menu select the Roll-up rule set that you defined previously
Click on Save changes
This is the result:
To learn more about multi-pass matching, See the page Multi-pass.