Determine count of unique rule instances for an application

I need to determine the number of unique rule instances our application contains. Is there a PRPC or database query I can run?

This is for a PRPC 6.2SP2 application that we are intending to upgrade.

***Edited by Moderator Marissa to update platform capability tags****


Keep up to date on this post and subscribe to comments

September 23, 2019 - 3:51pm


I don't know of a way to get all the rules for an entire application, however you could potentially create a report similar to Data-Rule-Summary.ListRuleSetContents listview to get the list of rules for each of the application's rulesets individually, adding criteria for version if needed.  Note that, by default, that report gets a maximum of 500 records, so if you have more rules than that it might not return a complete set of results.

Hope this helps!


September 28, 2019 - 2:22pm


In the Data-Rule-Summary class you can create a report definition that returns a count for every rule type in the system.

This class contains the following properties that are essential for rule reports:
 pzInsKey — key of the rule instance. This property is useful for joining other classes as we might
do with Rule History reports.
 pyClass — the class of the rule type. For example, Rule-Obj-Property is for property rules.
 pyClassName — the Apply To class of the rule. This could be, for example, the work class of a
purchase request application.
 pyRuleSet and pyRuleSetVersion — the ruleset and ruleset version.
 pyRuleName — a unique identifier used by the system; for example, CountOfLineItems.
 pyLabel — a short description of the rule. For example, the label for the property named
CountOfLineItems — could be Number of Items to Purchase.
 pyRuleAvailable — the availability of a rule.
 pxUpdateDateTime, pxUpdateOperator, and pxUpdateOpName — the most recent update

You can join other classes with the rule classes in order to provide more granular information. Some of the classes that are most commonly joined with the rule classes are:
 History-Rule instances represent rule updates.
 Data-Rule-Locking instances represent locks, or checkouts, of each rule.
 Index-Warning for rule warnings, like the performance warning that’s given if a non-optimized
property is used in a report.
 Index-CustomFields for custom fields defined for rules – a feature specifically designed to aid rule

For more details you can read Rule reporting topic. Please refer below link for more information.


September 28, 2019 - 7:03pm

You might want to write a report against Data-Rule-Summary class to get that data. Please summarize the rules by grouping against pyRuleSet and pyRuleSetVersion.

Please take a look at the report pyRulesByRulesetVersion as well.

September 28, 2019 - 7:05pm

If you want to get the information using SQL script, please refer to the following example:

SELECT count("PC0".pzInsKey) AS "rulecount" FROM <schema_name>.pr4_rule_vw "PC0" WHERE "PC0".pyRuleSet = 'Pega-RULES' AND "PC0".pyRuleSetVersion = '07-10-01';

Above is an example to get the count for ruleset "Pega-RULES" and ruleset version "07-10-01". You can change the values to get the rule count by whichever ruleset and version you need.