Question
VIRTUSA
IN
Last activity: 6 May 2016 13:40 EDT
What is the difference between declare on change and declare trigger? At what point of time declare on change will act?
I had a little confusion between declare on change and declare trigger. i knew that declare trigger will run an activity on save or delete (DB changes) from DB and declare on change will also run activity on change of property values defined on the rule.
As per statement of declare on change, whenever change in any defined property declare on change should fire. But here I have implemented one on change activity with some property, Whenever i changed any value I don't see on change activity.
Please help with this.
Regrads,
Chiranjeevi
Message was edited by: Lochan to add Category
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Pegasystems
US
One of the tabs on a decl-expr rule lets you decide whether every time the input properties change, the target property should be re-computed (forward chaining), or whether only when the target property is needed, only then is it computed from the latest values of the input properties (backward chaining).
If your inputs change more often than you need to actually use the target property, then backward chaining may be more efficient for you. On the other hand, if you know that any time one of the input properties change, it is important that the target property be updated, then forward chaining may be better. /Eric
Pegasystems Inc.
FR
Hello
Have you try to check with the tracer ? You need first to verify if your OnChange rule is called and then if the onchange Activity is called. If none of those two rules are called then maybe you are updating the wrong property on the wrong class ?
VIRTUSA
IN
Hi Marc,
ã
Thanks for your reply.
When i am tracing, i can able to see the declare on change updates. afer that there is no update on the case.
Example:
I had two fields like, First Name and Last Name, i have used these two in declare on change and i am calling an activity which will concatenate the First Name and Last Name and map to Full Name.
ã
As per Declare on change, If i change first name and last name, full name should update automatically right.
But i don' t see any value on Full Name field.
Thanks,
Chiranjeevi
Pegasystems Inc.
FR
Hello,
Can you share your XML tracer output ? I have to be careful with few things. The activity type for example should be "OnChange" and the activity will not update any activity forcing the OnChange rule to fire again.
I don't know how you check the values been updated but the OnChange rule isn't having auto commit so the changes might be lost if you are not saving the object holding the properties.
Coforge DPA
IN
Hi Chiranjeevi,
Please check
1)Whenever you are changing the first name or last name ,could you able to see the acivity executing,which is concatenating the first name and last name.
2)If the activity executing,in your declare on change activity please check the page on which the activity is running and are the values exists in that page context.
3)Normally for this type of scenario ,go for declare expression where on the change of First name or Last name u can update the Full name by concatenating both of them by using the forward chaining.
VIRTUSA
IN
Hi Prathap,
Thanks for your reply.
Actually i just want to understand that how Declare Trigger and Declare OnChange will work. I knew that Declare exp will work whenever input change, it will update the target property accordingly.
Here my doubt is how declare on Change will works. As per my understanding DExp will work as i explain above and D OnChange will run an activity whenever defined property changes and D Trigger will run activity whenever defined properties commited to DB. Please correct if i am wrong.
Regards,
Chiranjeevi
Coforge DPA
IN
yes chiranjeevi,what ever you have told is exactly correct.
VIRTUSA
IN
Hi Prathap,
Can u please give an example, when can we go for Declare-OnChange rather then Trigger or Expression.
Regards,
Chiranjeevi
Pegasystems
US
The declare-onchange could be better than declare-expression if you need to do something more extensive than update some properties in reaction to other properties changing.
The declare-trigger could be better than the others if various changes should be handled only at the time that the object is written, rather than handled when each change occurs.
/Eric
-
Gayatri Pavuluri
Pegasystems
US
No declaratives will fire from an activity whose security tab specifies that the activity is an "onchange" activity.
The intent is that you do your property-set in a different activity and that property-set should cause your "onchange" activity to fire, assuming your declare-on-change rule refers to it. /Eric
VIRTUSA
IN
Hi Osman,
Refered activity is an OnChange activity only.
VIRTUSA
IN
Hi Osman,
ã
Thanks for ur replay,
ã
I had an requirement, like i had an section which is having different country hub numbers as text fields [like Qatar Hub Number, Oman Hub Number] and Relation Country [Dropdown]. And i had another section in the same screen with field name called just hub number this is also text field.
ã
Requirement: Whenever user select relation country as Qatar and if Qatar Hub Number has an value then Hub Number field should update immediatly with Qatar Hub Number.
ã
Please suggest me which Declare rule is best suitable and weather Declare-OnChage Will Works here or not?
ã
Regards,
Chiranjeevi
Pegasystems
US
For that, I don't think you need a declare-rule at all. On the source field whose change should cause various target fields to change, in your design view, put in a behavior action that says "refresh section". Then in your activity or data transform rule associated with the refresh action, set the target properties. When the refresh is complete, you should see the updated target properties.
However, if are other places than the user editing the source field where such an update should occur, for example if there are places where you programmatically update the source property and expect the target properties to automatically update, then you may want to consider a declare-change or declare-expression rule. If you do this, you still need your action that says to refresh the section when the user changes the source field, but you may not need to associate an activity or data transform rule with the refresh action, since your declare-change or declare-expression rule should kick in. /Eric
VIRTUSA
IN
Hi Osman,
Thanks foir ur reply...
I had another question, like what is the difference between forward chaining and backward chaining?
I new that forward chaning means whenever input property value changes target property will calculate automatically. Can u please explain forward chaining with an example.
Thanks in advace.
Accepted Solution
Pegasystems
US
One of the tabs on a decl-expr rule lets you decide whether every time the input properties change, the target property should be re-computed (forward chaining), or whether only when the target property is needed, only then is it computed from the latest values of the input properties (backward chaining).
If your inputs change more often than you need to actually use the target property, then backward chaining may be more efficient for you. On the other hand, if you know that any time one of the input properties change, it is important that the target property be updated, then forward chaining may be better. /Eric