Question
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
NTT Data Corp
US
Last activity: 13 Jan 2016 9:37 EST
Help with Declare Expression
Hi,
We have a declare expression to calculate the amounts of all pages in the page list.
The page structure is like following:
TopPage(1). SubPage(1).Amount
TopPage(1). SubPage(2).Amount
TopPage(1). SubPage(3).Amount
TopPage(2). SubPage(1).Amount
TopPage(2). SubPage(2).Amount
TopPage(2). SubPage(3).Amount
Our requirement is, when the inputs changed, the total amount on all sub pages should be calculated and set to TopPage property.
Ex: TopPage(1).TotalAmount = TopPage(1). SubPage(1).Amount + TopPage(1). SubPage(2).Amount + TopPage(1). SubPage(3).Amount
we have few issues in writing declare expression to get expected results.
Can someone help me with this?
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Pegasystems Inc.
IN
Hi Uma, Good Morning!
could we please confirm ...
- if the target property is of mode single value, page or java property?
- would it make sense to test ...
- by specifying the target property of single value mode + same property type (referenced for calculation) at pyWorkpage level?
- would it make sense to test ...
or the calculation is not being happening at run time?
- is enable expression calculation option enabled or not in flow action rule under HTML tab?
would replacing the declare expression rule with a data transform a convincing choice?
Please share your observations/comments, Thank you!
psahukaru
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
NTT Data Corp
US
Hi Phani,
The target property is a single value mode property. Both the source and target properties are similar type.
The calculation is happening at run time. Instead of calculating at each top page level, it is summing all the amounts of all top pages.
We cannot replace Declare expression with Data transform in our scenario.
Thanks,
Uma Mahesh
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Pegasystems Inc.
IN
- could you please...
- copy the change tracking tab configuration...
- also debug the page context (top level page) or primary page from tracer...
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
NTT Data Corp
US
Calculate Values is selected as "Whenever Inputs Change"
and
Context Execution Behavior:
Execute this expression " Only when the top-level page is of the Applies To Class"
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Pegasystems Inc.
IN
>>> Execute this expression " Only when the top-level page is of the Applies To Class"
-
so is the context correct? when traced?
- quick test: could you please change it to 'Regardless of any pages it is contained in'?
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
NTT Data Corp
US
When I change it to 'Regardless of any pages it is contained in', I am getting the following error.
When I change it to 'Regardless of any pages it is contained in', I am getting the following error.
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Infosys
AU
What is the target property you have mentioned? is it .TopPage().TotalAmount or .TotalAmount
I think having .TotalAmount as the target property and setting it as sum of .SubPage().Amount might work.
Attaching screenshots of rule configuration will help.
Murali....
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
NTT Data Corp
US
Hi Murali,
The target property is .TotalAmount and the page context is .TopPage().
I couldnt attach the snapshot of the rule due to Client's restriction.