Discussion
TCS
IN
Last activity: 6 Apr 2015 8:28 EDT
Declare Expression
What is backward chaining and how it is differ from forward chaining?
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
US
Forward chaining is an internal mechanism that provides the automatic propagation of changes in one property value to changes in other property values or to indexes.
Forward chaining is an internal mechanism that provides the automatic propagation of changes in one property value to changes in other property values or to indexes.
In a Declare Expression rule, constraints rule, or Declare Index rule, you can establish required relationships among properties. When an activity step changes the value of a property that is defined in such rules, the system automatically consults an internal dependency network to see if other values are affected, and performs property value computations, indexing, and other processing as determined by the network. This is known as forward chaining.
Similarly, Declare OnChange and Declare Trigger rules implement automatic processing when certain database or property value conditions are met.
Forward chaining operates only when the source properties are not marked as invalid. If a property has an associated message, forward chaining halts.
Through a powerful technique known as backward chaining, PRPC allows a computation to advance even when the value of an input or parameter property is not available.
Declare Expression rules (Rule-Declare-Expressions rule type) and the Property-Seek-Value method work together to provide this capability. The system uses the internal dependency network of property relationships to develop inferences about how to obtain the missing property value.
Such computations are sometimes called goal-seeking, as the system reaches a final goal (finding a value for property X) by completing other goals (finding a value for properties that allow X to be computed).
Two standard flow actions VerifyProperty and VerifyPropertyWithListing provide examples ofbackward chaining.
Forward chaining populates a value based on changes in other values that are part of a formula. Backward chaining will populate a value from a formula even if a value in that formula is missing.
Bill Rathert
TCS
IN
How backward chaining will populate a value from a formula if a value is missing? Please explain me by giving one example?
Pegasystems Inc.
US
Here is an example from the pdn.
Backward chaining executes declare expression rules when a value is needed for a property, as opposed to when inputs change. For example, a value may be needed because a property’s value is referenced in an HTML stream for display.
Backward chaining applies to declare expressions rules with the Calculate Value field set to one of the following:
- When used if no value present
- When used, if property is missing
- Whenever used
Think of it like this … the system says “I need property X, if it isn’t there, calculate it for me”.
For example: Area = Length x Width and is set up for backward chaining with the “Whenever used” option set on the Area property. If you try to display Area (even just in the property rule preview), the declare expression rule re-computes. This re-computation is driven by the use or referencing of Area, not by any changes in Length or Width.
If a value for Area is needed through backward chaining, but Length has no value, the chaining may continue using a declare expression rule to calculate Length, and so on. Alternatively, the application can prompt a user to enter a value.
Experiment with backward chaining using the following standard rules
Here is an example from the pdn.
Backward chaining executes declare expression rules when a value is needed for a property, as opposed to when inputs change. For example, a value may be needed because a property’s value is referenced in an HTML stream for display.
Backward chaining applies to declare expressions rules with the Calculate Value field set to one of the following:
- When used if no value present
- When used, if property is missing
- Whenever used
Think of it like this … the system says “I need property X, if it isn’t there, calculate it for me”.
For example: Area = Length x Width and is set up for backward chaining with the “Whenever used” option set on the Area property. If you try to display Area (even just in the property rule preview), the declare expression rule re-computes. This re-computation is driven by the use or referencing of Area, not by any changes in Length or Width.
If a value for Area is needed through backward chaining, but Length has no value, the chaining may continue using a declare expression rule to calculate Length, and so on. Alternatively, the application can prompt a user to enter a value.
Experiment with backward chaining using the following standard rules
- Work-.VerifyProperty flow action
- Work-.VerifyPropertywithListing flow action
- Work-.PromptGoalSeekProperty HTML rule
- Work-.VerifyProperty activity
The Property-Seek-Value method is the foundation of backward-chained processing. What is really important to understand is that the system will only execute the required calculations as needed, which can result in huge efficiency gains.
A simplier example is:
I know my monthly mortgage payment, the total left to pay, and the interest. I want to figure out how many months are left to pay. I would write a Declaritive rule and backward chain it to find that value.
Pegasystems Inc.
US
Here is an example from the pdn.
Backward chaining executes declare expression rules when a value is needed for a property, as opposed to when inputs change. For example, a value may be needed because a property’s value is referenced in an HTML stream for display.
Backward chaining applies to declare expressions rules with the Calculate Value field set to one of the following:
- When used if no value present
- When used, if property is missing
- Whenever used
Think of it like this … the system says “I need property X, if it isn’t there, calculate it for me”.
For example: Area = Length x Width and is set up for backward chaining with the “Whenever used” option set on the Area property. If you try to display Area (even just in the property rule preview), the declare expression rule re-computes. This re-computation is driven by the use or referencing of Area, not by any changes in Length or Width.
If a value for Area is needed through backward chaining, but Length has no value, the chaining may continue using a declare expression rule to calculate Length, and so on. Alternatively, the application can prompt a user to enter a value.
Experiment with backward chaining using the following standard rules
Here is an example from the pdn.
Backward chaining executes declare expression rules when a value is needed for a property, as opposed to when inputs change. For example, a value may be needed because a property’s value is referenced in an HTML stream for display.
Backward chaining applies to declare expressions rules with the Calculate Value field set to one of the following:
- When used if no value present
- When used, if property is missing
- Whenever used
Think of it like this … the system says “I need property X, if it isn’t there, calculate it for me”.
For example: Area = Length x Width and is set up for backward chaining with the “Whenever used” option set on the Area property. If you try to display Area (even just in the property rule preview), the declare expression rule re-computes. This re-computation is driven by the use or referencing of Area, not by any changes in Length or Width.
If a value for Area is needed through backward chaining, but Length has no value, the chaining may continue using a declare expression rule to calculate Length, and so on. Alternatively, the application can prompt a user to enter a value.
Experiment with backward chaining using the following standard rules
- Work-.VerifyProperty flow action
- Work-.VerifyPropertywithListing flow action
- Work-.PromptGoalSeekProperty HTML rule
- Work-.VerifyProperty activity
The Property-Seek-Value method is the foundation of backward-chained processing. What is really important to understand is that the system will only execute the required calculations as needed, which can result in huge efficiency gains.
A simplier example is:
I know my monthly mortgage payment, the total left to pay, and the interest. I want to figure out how many months are left to pay. I would write a Declaritive rule and backward chain it to find that value.
TCS
IN
In my application there are three properties in one form such as new reading , old reading and FTT reading.I want to calculate FTT reading by the formula -> new reading - old reading . What 'll i do ?please suggest me.
Pegasystems Inc.
US
Create a Declaritive Expression Rule by going New>Decision>Declare Expression. Give the Expression a Name and Target Property (the Property that will hold the result of the claculation) click Create and Open. Then do a valie of and write your formula. .NewReading-.OldReading
Bill Rathert