How to create Declarative indexes for embedded properties
The Declarative Index wizard provides a guided series of forms to create an Index- class, properties, and a Declare Index rule. This wizard is helpful for the creation of Index- instances that allow selection and reporting on a property that is embedded within a work object.
Process Commander saves, in the PegaRULES database, the values of properties that are within an embedded page of a complex structure within the blob or Storage Stream column (pzPvStream property).
In the Userv-InsuranceProducts sample application, the
Page List property Family can contain pages with the two properties Make and Name:
These two embedded properties cannot be directly exposed as columns in the PegaRULES database that holds Userv-InsuranceProduct work objects, since one work object may have multiple Family pages.
Through instances of an Index- class, the values of these properties can be linked to the corresponding work object. Reporting can use the Join feature of list view rules to combine Index- instances with work objects.
The Declarative Index wizard requires a database account for the PegaRULES database that has the
ALTER TABLE and
CREATE TABLE grants.
The typical database account used for Process Commander server access to the PegaRULES database does not provide such grants. However, a special-purpose account supporting this wizard may be identified on the Database tab of the Database form, in your system's
prconfig.xml file, or through a JNDI configuration referenced on that tab.
1. Locate the embedded scalar property to be indexed in the Application Explorer tree display.
Right-click to access a context menu.
2. Select Index Property from the context menu.
2. In the pop-up dialog box, enter a RuleSet and Version for these rules:
5. Click Create. The wizard creates a concrete Index- class, a property in that class, a Declare Expression rule, and if necessary a Database Table data instance linked to a new table in the PegaRULES database. The wizard reports results:
The name of the class rule created by the Wizard is "Index-" followed by the name of the Page Class of the Family property. (The wizard reuses this class if it already exists.)
Like all concrete classes, the key of the Index instances identifies the original object and a "use count". In this case, the values of pxInsIndexedKey identify a Userv-InsuranceProducts work object.
The Declare Index rule created by the wizard builds and maintains instances of the Index-Userv-Data-FamilyMembers class automatically, starting immediately. Each instance contains a Name property value equal to the value of the original, embedded Name property.
Through the Join features of list view rules, you can now select all work objects which have a family member named "Anne". See How to report on two or more indexed tables using Join.
The Declare Index rule starts execution automatically, but only when a work object is saved or resaved to the PegaRULES database. For open work objects, this occurs at the next Commit operation — typically when the next assignment is completed.
However, to ensure index completeness for both open and resolved work objects, run the ResaverServlet servlet, or the standard activity Code-.ReCreateIndexesForClass. (This may require minutes or hours to complete, depending on the volume of existing work objects.)