0% found this document useful (0 votes)
5 views

declarative processing

The document explains the declarative processing in Pega, highlighting its internal declarative engine that uses a Directed Acyclic Graph (DAG) for evaluation. It outlines six types of declarative rules, including Declare Expression, Declare On Change, Declare Trigger, Declare Index, Constraints, and Data Pages, which automate business logic without manual invocation. Additionally, it provides examples and explanations for each rule type, emphasizing their role in enhancing efficiency and maintaining data integrity.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

declarative processing

The document explains the declarative processing in Pega, highlighting its internal declarative engine that uses a Directed Acyclic Graph (DAG) for evaluation. It outlines six types of declarative rules, including Declare Expression, Declare On Change, Declare Trigger, Declare Index, Constraints, and Data Pages, which automate business logic without manual invocation. Additionally, it provides examples and explanations for each rule type, emphasizing their role in enhancing efficiency and maintaining data integrity.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

DECLARATIVE PROCESSING IN PEGA

Pega has an internal declarative engine that utilizes abstract Java engine libraries for evaluation.
These libraries use a Directed Acyclic Graph (DAG) network to maintain the declarative
structure. The major difference between cyclic and acyclic graphs is that a cyclic graph can have
closed loops, whereas an acyclic graph has no loops.
In Pega we can write a business logic in two ways:
1) Structural processing: when you can create activity, data transform and other rules and
make sure you manually invoke them at the right places.
2) Declarative processing: you can use a set of declarative rules, to automatically compute
some activity rule using the declarative DAG network. Declarative rules can be called
business rules and can be delegated to business users.
Pega platform provides six types of declarative rules to support declarative processing.
➢ Declare expression (Rule-Declare-Expressions rule type)- mainly used to calculate
target properties when the depended properties change.
➢ Declare on change (Rule-Declare-OnChange rule type)- automatically executes an
action when the dependent property changes.
➢ Declare trigger (Rule-Declare-Trigger rule types)- automatically executes activities
or flow when an instance is created, updated or delated.
➢ Declare index (Rule-Declare-Index rule type)- automatically creates and maintain
indexes for embedded properties
➢ Constraints (Rule-Declare-Constraints rule type)- automatically enforce condition
and validation when referred.
➢ Data pages- also declare pages that can automatically load the data when referred.
(I’ve covered various declarative rules in Pega. Stay tuned—we’ll dive deeper into
Data Pages in an upcoming discussion!)
There is no need to call these rules manually.

What is declare expression rule?


It helps to compute a value based on expressions. mainly used to calculate target properties
when the depended properties change.it comes under decision category.
Declare expression rule can get triggered automatically based on two methods:
➢ Forward chaining: when ever input changes targeted property get changes.

Example: Total price= cost *Quantity, here if the input values changes(cost, quantity) the
total price also changes.
C=A+B
When A or B value changes C get calculated.

➢ Backward chaining: it is exactly opposite to forward chaining. The application performs


calculation only when the targeted property referred.

Linked In: Bobby Sanaboyina


Example: let’s take an example of discount calculation with a coupon code field.
When the coupon code is referred in the field as the target property and the discount can
be calculated based on the products.
C=A+B
When c get referred it uses backward chaining to find and use value of A & B for
calculation .

(It is very rare nowadays that we use backward chaining in the application processing)
We can configure a declare expression can be done in two places.
➢ Manually creating the declare expression.
➢ From case designer data modelling.

What is declare on change?


Declare on change comes under decision category and implements forward chaining. When a
value of specific property changes then it executes an activity.
Example : imagine a shopping cart in a web site, here the condition is if the total cost is greater
than certain value we have to add a free gift this can be archived by using declare on change.

What is declare trigger?


Declare Trigger, also categorized under decision rules, implements forward chaining. It executes
an activity when an instance of a specific class is created, updated, or deleted. This rule is useful
for automatically updating records when specific changes occur.
( it identifies an activity that runs automatically when an instance of a specific class is saved or
deleted, allowing for automated actions based on data changes.)
Example: Imagine you have an order processing system where you need to update the order
status when the payment is received. Instead of manually checking the payment field every time,
you can create a declare trigger that “watches” the payment field. As soon as the payment is
marked as received, the trigger automatically updates the order status to "Completed.".
I’m an EEE student so I compared it with a sensor.
Think of it like a sensor: when something changes (for example, a property value), the trigger
checks if it meets the set condition, and if it does, it “fires” to perform specific tasks like
updating other properties or executing business logic.

What is Declare index?


A Declare Index rule automatically creates and maintains an index for embedded properties,
improving performance when querying large datasets or navigating relationships within the
application. It typically falls under the system administration category.

Linked In: Bobby Sanaboyina


Example: Imagine a library where you need to find a book quickly. Instead of searching each
shelf manually, you use an index to locate it instantly. Similarly, Pega's Declare Index rule
maintains indexes for important data, ensuring efficient searches and lookups.

What is constrain ?
Constraints in Pega are declarative rules used to enforce conditions and validations on property
values.it comes under decision category. When a property with an associated constraint is
referred to or modified, the rule automatically checks that the data meets the required condition.
This ensures data integrity and prevents invalid data from being stored or processed.
Example: If a rule specifies that Age must be between 18 and 65, every time someone enters an
age, Pega verifies it. If the value is outside the allowed range, an error message appears or the
data is rejected

I hope this guide clarifies Declarative Processing in Pega!

Linked In: Bobby Sanaboyina

You might also like