How to report on Custom Fields
Summary
Custom Fields are an array of properties comprising a name and value pair that you can add to rules to help identify them for specific development purposes such as indicating a theme, a change order number, a person who requested the change, and so on. You can associate Custom Fields with any unlocked rule and later search for rules that contain a specified name and value pair.
Process Commander provides a wizard that enables you to search for rule instances by Custom Field names and to create a list view report. You access the wizard by selecting the menu item View > Rules > Find by a Custom Field. By default, the wizard searches rule types that belong in the Decision category. The report displays the list of items categorized by class.
To meet your specific reporting requirements, you can also use instances of the list view rules in the Index-CustomFields class to create and customize reports of Custom Fields. Instances of Custom Rule properties correspond to instances of the Index-CustomFields class within the pr_index_customfields
database table. For reporting purposes, you must expose properties as columns when you create Custom Rules.
This article presents an example that shows how to create Custom Field properties, expose them in the pr_index_customfields
table, and create a list view report.
Suggested Approach
In this example, you will do the following:
- Create a Custom Field property called ProjectID and add it to a rule.
- Expose the new Custom Field property as a column in the table
pr_index_customfields
. - Create a list view rule for Custom Fields, configure the rule, and run the report
To create a Custom Field and add it to a rule:
- Open a rule instance to which you want to add your Custom Field.
- On the History tab, click the Update button. The Custom Fields editor appears as shown here:
- Click Add Field. The New Field section appears.
- Enter “ProjectID” in the Name field and enter a “1” in the Value field as shown here:
- Click Add. The Custom Field and its value appear in the editor.
- Click Apply in the editor. The field name and value appear in the rule form as shown here:
- Save the rule instance. Process Commander automatically creates instances of properties Embed-CustomFields and Index-CustomFields using the key ProjectID.
- Use the History tab and Custom Fields editor as described above to add ProjectID to other rules. Note that you can select ProjectID from the Name pull-down list in the editor.
To expose the ProjectID property:
- Select menu item Tools > Database > Modify Database Schema to open the View/Modify Database Schema wizard.
- In the Select a Database step, select the PegaRULES database and click Next.
- In the Select a Table step, select
pr_index_customfields
from the drop-down list and click Next. - In the View Table step, select the number of properties link in the Set to be visible field as shown here:
- In the View Properties step, check the ProjectID property as shown here:
- Select Generate SQL Code (if a database administrator must make the table change) or Generate Database Columns (if you can make the change) and click Create selected columns.
When you generate the database columns, a confirmation appears
- Click Close.
To create a list view rule for Custom Fields and run the report:
- Create a list view rule with Index-CustomFields as the Applies To key part. Set the second key part to a name of your choice. Typically, set the third key part to “All”. The List View rule form appears.
- Enter the criteria you want to use to configure your report. In this example, you want to:
- Include ProjectIDs with values of 2 through 5
- Include, for each item, the RuleSet, version, class, rule instance key, operator who created the instance, and update date and time
- Categorize the report by ProjectID
Here is the
Display Field
- s tab in which you specify the fields and labels that are displayed in the report:
- Here is the
Content
- tab in which you specify the range of Project IDs and the report content:
- Here is the Categorize By array on the
Organize
- tab in which you specify ProjectID as the report category:
- When you finish configuring the list view rule, save it.
- Click the Run toolbar tool to execute the list view report . Here is the report: