Declarative Rules Flashcards

1
Q

Declarative rules features

A
  • declarative rules are not invoked from other rules.
  • no dependency on other rules
  • easy creation and deletion
  • easy for us to separate business rules from the process
  • gives us the option to delegate these rules to business managers. A declare expression can invoke a decision table and the managers can modify decision tables directly in production.
  • speedier development because developers only need to configure the rules and not decide on where to put the rule
  • Development time is shorter because the code is less prone to errors since the declarative engine handles the processing of the rules.
  • Maintenance is easier since newer teams do not need to dig through to locate these rules and the rules are easier to configure than activities.
  • Declarative rules support all those features that apply to other rules such as class specialization, ruleset and rule specialization, circumstancing and or effective date.
  • Better Performance.The declarative engine controls the execution and it is always better than a procedural rule such as an activity or a data transform.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Where you can get access the declaratives defined in that application?

A
  • We can use the Declarative Network landing page to access the declaratives defined in that application.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Declarative rule execution

A
  • All declarative rules use source and target properties:
    • The target property is what is being calculated or computed using these declaratives and
    • Source properties (in some cases there is more than one property) are the ones which are used as an input.

Forward chaining is executed when the value of any of the source properties change. Most of the declarative rules follow forward chaining.

Backward Chaining mode executes when the target property is referenced. Backward chaining is supported only for declare expressions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How declarative rules recalculation can be triggered?

A

Forward chaining:
1. Whenever inputs change

1: the expression is calculated whenever any of the source properties change

Backward chaining:
1. When used, if no value is present
2. When used, if property is missing
3. Whenever used
1&2:
make sure the expression is calculated only once in the case lifecycle unless the property is removed from clipboard.
3:
system throws a performance warning, indicating that the expression will fire as many times as the target property is referenced
(The target property is considered used when it’s referenced by its name, such as in a UI rule, in a decision tree or in a data transform.)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Declarative rule execution in case of Constraints

A

when the value changes, the constraint is executed to verify that the value conforms to the conditions expressed. Constraints can have any number of rows and the order in which they are listed is not significant. The message text can be entered directly in the rule form or saved as a message rule which can be referenced.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Declarative rule execution in case of OnChange

A

Declare OnChange can track several properties that have been saved as part of the case. When one or more of these properties change it invokes the activity which has the logic to be performed. The Declarative Engine invokes the activity only once if more than one property gets changed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Declarative rule execution in case of Declare Trigger

A

The Declare Trigger executes when instance of its classes are created, saved or deleted in the database. On the database event, it triggers an activity which contains the logic to be performed. Triggers can be used in cases when we want to capture the history of how a property got different values over the case lifecycle. For example, the audit trail must contain information about the different values stored as part of discount. Whenever the values in the discount change, it causes the trigger to fire the standard activity which writes an entry to the audit trail.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the performance impacts of using/not using Declarative Processing?

A
  • Forward chaining (FC) becomes more performance intensive if the expression uses lot of factors and they change quite frequently.
  • Keep using FC if you have to reflect the target change to the user after every source change, if not use BC.
  • When using Backward chaining we need to determine the execution depending on how the target property is referenced.
  • We cannot select When Used if no value or When Used if not present if we know the source properties can change.
  • evaluation can cause severe application errors that would not otherwise occur with procedural evaluation.
  • declarative rule may cause the system to access pages that have not been created or properties that have not been set, leading to unpredictable results.
  • With a procedural alternative, we can better control rule evaluation. So, if we need to perform a calculation at a specific point in a process, a procedural approach may prove less error-prone than a declarative approach.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What additional setup is required for a Declare Expression if the target property is a page list or a page group?

A

If the target property is of page list or page group then we need to identify the Page Context. ( .LineItems() )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Ways to set target property value in a Declare Expression

A
  • prebuilt calculation types are different for each target property type

Value of:

  • decimal: free-form expression, absolut value of, bound between
  • integer: rounded to the nearest integer value, index of substring in main string, index of the maximum value in a collection

others:

  • sum, min/max, avarage, count, min/max index
  • “result of the decision tree/table”, “result of map value”–> call other business rules and take their return value and set the target property
  • “Value of first matching property in parent pages” option allows declare expressions to “reflect” a value for a property of the same name on a parent page. The class of the target page must equal or be a descendent of the class of the declare expressions rule.

for text:
- can be only Value of and Result of: free form expression, string replace, lowercase, substring, trim white space, uppercase

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a function rule?

A

A function is a rule type in Pega that is used in various other rules. Functions allow us to extend PRPC capabilities by using custom java code. Functions belong to Technical Category (Rule-Utility-Function) and are grouped by Library.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is Context Execution behavior?

A

The term context sensitive really means that the path defined by the page context + target property must be complete from the top level page that derives from the Applies to class.

Context free expressions allow us to define the expression without taking into account where it is used in the expression. This option is best used for calculations that are ALWAYS necessary and the same, regardless of where the object is embedded.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is Declarative Network?

A
  • Shows expressions with all the nexted calculations and all the used properties.
  • The landing page shows us the “top most” expressions.
  • go Process & Rules > Business Rules > Declarative Network
  • Basic Tree, Cascade Tree, Org chart
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How you can unit test a declarative expression?

A
  • In the declarative network on a specific property we can by clicking the run button to see the test expression screen.
  • This form can also be accessed directly from the declare expression rule using the actions menu and clicking Run.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

In which situations Declare Expressions are useful?

A

Declare expressions are useful in cases when we want to calculate the total price on a purchase request, or derive the quote for an insurance policy.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly