Show
all
Proj-840 5.4 To speed reporting, searching, or other access,
you can create a Declare Index rule automatically for a property embedded
in a Page
, Page List
, or Page
Group
property. A wizard guides you through the necessary steps.
This feature requires a user account for the PegaRULES database that has
specific capabilities and privileges.
For example, if the work objects in your application can contain an
array with possibly many Universal Product Code (UPC) codes, you can
create these with the wizard:
A new class (derived from the Index- base class) to hold
declarative index instances
- Several properties in the new class, including the three
properties that comprise the key
- A new table in the PegaRULES database to hold the index rows
- A Database Table instance (Data-Admin-DB-Table)
linking the new class to the new PegaRULES database table
- A Declare Index rule (Rule-Declare-Index rule type)
that performs the indexing
As with Declare Index rules that you create with the Declare Index
rule form, indexing begins immediately
Don't confuse declarative indexes
(instance of a concrete class derived from the Index- base
class) with database indexes (defined through database software
facilities, typically by a database administrator). The purpose and goals
are similar, but the specific mechanisms are different.
After you implement a declarative index, reports
can use the indexed property value as a selection criterion. For example,
if the embedded Universal Product Code (UPC) codes in a work object are
indexed, you can report on all work objects containing a specific UPC
code. Reference the index class on the Contents and Join tabs of the
List View form or Summary View form.
Examples
For an example use of the wizard including screen images, see Pega
Developer Network article PRKB-25278 How to create
Declarative indexes for embedded properties.
As a second example: A purchasing application contains a work type
MyCo-PurchaseRequest. The Page List
property
PurchaseRequest.Lines() contains one page for each line item. The
property Lines has the Page Class
value Embed-PR-Line.
Single Value
properties on this page identify a product
(by Universal Product Code or UPC), the quantity, and other
details.
In this data structure, you cannot expose the property
MyCo-PurchaseRequest.Lines().UPC, as it is embedded. Accordingly, you
cannot select all work objects that include a specific UPC value in a
list view report. However, you can create an index using the
Declarative Index wizard, and then join the index with the work object
in a report.
The wizard creates several rules and one data instance:
- A class named Index-Embed-PR-Line
- Several properties in the Index-Embed-PR-Line class, including
three that form the key to the Index-Embed-PR-Line instances, and
the indexed property UPC
- A database table to hold index instances, such as
pc_work_idx
- A Data-Admin-DB-Table instance linking the class
to the database table
Before you
begin
This feature requires access to a PegaRULES database account that
has the ability to define database tables (specifically, the
ALTER TABLE
and CREATE TABLE
grants or
privileges).
You can identify the account name and password on the Database
Table form for the PegaRULES database, by completing the Admin
UserName and Admin Password fields on the
Database tab. Alternatively, for greater
security, add two or three elements in the prconfig.xml
file to identify this account, in the following format:
<env
name="database/databases/PegaRULES/adminUserName"
value="usn" />
<env name="database/databases/PegaRULES/adminPassword"
value="pwd" />
<env name="database/databases/PegaRULES/databaseType"
value="type" />
where usn is a user name, pwd is a password, and
type is one of the keywords (note spaces and
capitalization)
MS SQLServer
Oracle
DB2
DB2 OS/390
Apache Derby
The databaseType
element is optional. You can omit the
databaseType
element in the common case that your JDBC
driver software is supplied by the database vendor; for example, if
you obtained the Oracle JDBC driver from Oracle Corporation.
If policies or practices in your organization
do not allow the creation of a database user account with the
necessary granted privileges, you can use the Declarative Index wizard
to create the rules and the Database Table instance
(Data-Admin-DB-Table). In this situation, the wizard
cannot create the PegaRULES database table; you can ask a database
administrator who has the appropriate authority to perform the CREATE
TABLE SQL statement. See How to set up an
index.
Using the
wizard
To create a declarative index on an embedded property:
- Plan ahead to identify the RuleSet and Version to contain the
rules created by the wizard.
- Review existing Declare Index rules to confirm that the
property is not already indexed. (Do not attempt to use this wizard
to index a property that is already indexed.)
- Locate the embedded property in the Application Explorer. The
property can be embedded in a
Page
, Page
List
, or Page Group
property.
- Right-click to access the Application Explorer context menu.
Select Index Property from the menu.
- On the first pop-up window that appears, select a RuleSet and
Version to hold the rules generated by this wizard. Click
Submit.
- A confirmation form identifies the class, property and Declare
Index rule created. Indexing operations are started. You can click
the pencil icon () to review the
rules.
Notes
The PegaRULES database tables created by this wizard have names
than end in -idx. This naming convention is distinct from the names of
standard tables for Index- instances, which start with
pr_index_.
You can run the standard activity
Code-.RecreateIndexesForClass to rebuild indexes for all
the instances of a single concrete class, identified by an activity
parameter.
The
Code-.RecreateIndexesForClass activity does not remove
existing dangling instances, those that reference a deleted or renamed
object. However, normal declarative index processing removes index
instances when the use count reaches zero, so dangling instances can
only occur through errors and exceptional situations.
If your application contains thousands
or millions of existing instances to be processed by this activity,
processing may take hours and can impact overall system performance.
Consider off-hours or agent processing.
Tools, accelerators, and wizards