How to use the Rule Compare utility to identify differences between rules
The Rule Compare utility helps you compare different versions of rules. The side-by-side comparison lets you quickly find the additions, changes, or deletions that have been made between one version of a rule and another.
The utility lets you compare any two rule instances of the same rule type, whether or not they have the same name or are related to each other. You cannot compare a rule instance with itself.
After you select two rule instances, the utility displays all the additions, deletions, and value changes between the two instances, presuming that the first instance chosen is the original. You can export this report, or drill down to see the details of a specific change.
The Rule Compare utility lets you compare any two rule instances of the same rule type -- two instances of the same rule, or instances of two rules with different names and versions. In the 'Suggested Approach' section the goal is to inspect two versions of the same rule, as this how the gadget will most often be used.
There are two ways to access the utility:
To compare differences between instances of any rule or rules:
- Select the Pega button ( ) and then select System > Tools > Refactor Rules > Compare Rules. The utility's main screen appears.
In the panel labeled Instance #1, set search terms to help you find the first of the two rule instances you want to compare. Specify a Rule Type, and optionally specify a Rule Name, class, RuleSet, and RuleSet Version to narrow the field of candidates.
Click the displayed Rule Type and select another value from the list that appears to search for a different type of rule. You cannot search more than one Rule Type at a time.
When you are satisfied with your search terms, click Find. The utility displays a list of rules and versions that match your search terms:
Click the title of any column to sort the display by the values in that column. Click the title again to reverse the sort order.
Click the radio button to the left of a version to use it in the comparison.
Note that a second panel, headed Instance #2, has appeared. This panel displays the same search results as the first panel. If the second rule instance you want for the comparison is in the list, click the button beside its name to select it.
If you cannot find the rule you need for the comparison, adjust the search terms in the second panel and click its Find button to refresh the list of candidate rule instances. Use this panel as you did the first one to find the second rule to use in the comparison.
When you have selected two rule instances to compare, click the Compare >> button at the bottom of the screen. The Differences Found report appears:
When you double-click one of the differences found in the report, the Comparison of rules screen appears. The first rule you selected populates the left column, and material from the second rule instance appears on the right:
Differences are highlighted:
- in yellow when a value in the two instances does not match
- in green when there is material in the second rule that does not appear in the first rule. The utility presumes the first rule selected was the source instance, so changes highlighted in green are considered "added"
- in red when there is material in the first rule that does not appear in the second rule. The utility presumes the first rule selected was the source instance, so these changes are considered "deleted"
If the screen displays a long selection of code that includes more than one change, you can move from change to change by clicking the left and right arrow keys at the top of the screen. You can also use the search field to locate a specific text string in the display.
Browse the display by using the scroll bars at the right of each column. Each scroll bar controls both columns, which move together to maintain the relationship between the material displayed from each rule instance.
When you are finished reviewing the differences, close the window by clicking the red X button at the top right, or by clicking the Close button at the bottom of the screen.
To compare differences between instances of the current rule:
You can quickly research differences between instances of a specific rule:
- Navigate to History tab of any rule.
- Click History Details . A new window appears with a table listing all versions of the rule:
- Check the checkboxes to the right of any two versions and click Compare . The Differences Found report of the Rule Diff utility appears (see above).
Note: if the current rule is checked out, the Compare With Checked Out button appears at the bottom right. It is disabled until you select one version of the rule. It then becomes active: click it to compare the version you selected with the checked-out version of the rule:
The version you selected is "Instance #1" in the Differences Found display, and the checked-out version is "Instance #2".
If you select a second version to compare, the Compare with Checked Out button becomes disabled again.