Pega - DECLARATIVE RULES Interview Q&A

Declarative:

  The declarative rule is an instance of a class derived from Rule-Declared-

  They allow for automatic processing of Property values.

  No need to be called explicitly.

  No need to run sequentially.

  The system manages re-evaluation when it detects a change.



 Name some declarative rules?

Rule-Declare-Expressions, OnChange, Constraints, Trigger, Index.

 What is Declare-Expression? Explain?

An Expression executed automatically in response to a property value change in with the expression.

Declare Expression rules are instances of the Rule-Declare-Expressions rule type. They are part of the Decision category.

We can create Declare-Expression rule instead of using a property set method in an Activity.

 What is the use of Page Context?

Page Context is used if the target property is in PageList of PageGroup.

If target property has mode single value and appears directly on the page of applied to a class, Page Context should be blank. This called Context-Free expression.

 What is Forward Chaining?

Forward Chaining provides the automatic calculation of the property by executing the declarative rule when any one of the input property value is changed.

For example, if the Area property depends on the length and width property, then Forward Chaining causes the area property to be recalculated every time either length or width values change.

 What is Backward Chaining?

Back Ward chaining provides the automatic calculation of the property by executing the declarative rule, when the value is needed for the property, rather than when input change.

For example, if the area property depends on length and width property, the back ward chaining causes the area property to be recalculated each time the area property is required.

 Almost all the declarative rules implement only forward chaining, except the Rule-Declare-Expression.

In rule-Declare-Expression, we have a choice to decide either we should go to Forward chaining or Backward chaining.

 Explain about Rule-Declare OnChange?

Runs an activity automatically when the value of specified property changes.

It is always Forward Chaining.

If we specified more than one property, they all must be on the same page.

  How to implement Rule-Declare-OnChange?

Ø  Create an instance of Rule-declare-OnChange

Ø  Select the properties we want this rule to keep a track of.

Ø  Optionally enter a when condition rule to be evaluated.

Ø  Provide the activity name of type OnChange.

 Explain about Declare Triggers?

Declare The trigger runs an activity when instances of specific classes are created, updated, or deleted in the Database.

Declare The trigger is always Forward Chaining.

 Explain about Constraints?

Constraints are used for validation purposes.

Define and enforce relationships among property values.

Prevent user from advancing if the constraint is not satisfied.

Prevent invalid data entered.

Constrains are always Forward Chaining.

 What is the difference between Constraints and Validation Rules?

Constraints are declarative rules triggered automatically when a property value changes?

Validation rules must be told when to run when a form is submitted, or Before running aFlow Action.

 Explain about Declare Index?

Declare Index rules are instances of the Rule-Declare-Index class.

Declare Index Automatically extracts a value from an embedded property when its value has changed.

They are part of the sysadmin category.

 How do we implement the Declare Index?

Step 1: Create a class inherits from the Index- class.

Provide these three properties: pxInsIndexedKey, pxIndexCount, pxIndexPurpose.

Step 2: Create Rule-Declare-Index and provide Source Page Context and Source page

Context class, Index class to write.

Step 3: In list view, Join tab provides Declare Index name.




3 comments: