Question
Salame
Last activity: 5 May 2016 9:52 EDT
Get Maximum of a property value inside a pagelist
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Updated: 3 May 2016 8:00 EDT
Pegasystems Inc.
GB
You could define a local variable to store the value of DisplayOrder for the current itteration, and only update it (using the step precondition) if the current value is greater than the current value of the local variable. After the itteration has finished you will be left with the max value in the local variable which you can the do what you want with.
Pegasystems Inc.
HK
Hello Rosy
Why not adding the sorting order based on your property when you do the Obj-Browse or RDB-List..BTw, You can always use Obj-Sort to get the last/first one based on your sorting order.
Hope this helps.
Cheers,
-
Zeqi Chen
Salame
Thanks Frank for your reply, however, this activity is launched on row addition. I want on each row added to compute max(this property) + 1, that's why, I cannot use in my context obj-sort.
Any idea?
Thanks,
Rosy
Citicorp Services India Private Limited
IN
Hi Rosy,
Creating a declare expression for DisplayOrder property will help?
Thanks,
Gowrishankar.
Salame
Thanks a lot Gowrishankar Ramasamy, but, can you please give me some details on this expression and where to call it?
Thanks
Rosy
Updated: 3 May 2016 8:32 EDT
Citicorp Services India Private Limited
IN
Hi Rosy,
You can create a integer property say (maxOrder) in the data class (Data-AssetClass) / work class to hold the Max value . Create the declare expression on the maxOrder property in your work class / data class. This property value will get reflected whenever the value changes in the respective addition/deletion of rows . You can refer the property wherever you need.
Please let me know if this helps.
Thanks,
Gowrishankar.
Pegasystems Inc.
AU
If you'd prefer to do it without the expression, the function directly is @ExpressionEvaluators.max(.PageList().PropertyName)
-
ShanmugaPriyan Rangasamy
Salame
Thanks a lot Gowrishankar! I will try that and will let you know.
Rosy
Accepted Solution
Updated: 3 May 2016 8:00 EDT
Pegasystems Inc.
GB
You could define a local variable to store the value of DisplayOrder for the current itteration, and only update it (using the step precondition) if the current value is greater than the current value of the local variable. After the itteration has finished you will be left with the max value in the local variable which you can the do what you want with.
Salame
Thanks Marc, I will try it and get back to you.
Thanks a lot
Salame
Thanks a lot Marc. it works perfectly
Pegasystems Inc.
IN
would leveraging report definition works here?
Salame
Hi phani, I cannot as the content she be editable, not read-only
Pegasystems Inc.
HK
Rosy,
If you are on oa repeat layout, you could easily call the OOTB pre/post activity when there is update on the grid.
You can find these settings on Operations->Advanced configuration.
Hope this help..
cheers,
Salame
Hi Frank, can you please give me more details?
I want on the new row to get max(property) + 1.
Regards,
Rosy
Pegasystems Inc.
AU
Pegasystems Inc.
HK
I still don't understand your exact requirement.
But as Nicolas suggested you can use pre and post activities available in Grid to set some values before the row is rendered at client side.
Salame
Hi Sathish,
On row add, I want to populate DisplayOrder cell by ( Max(DisplayOrder) + 1 ) (my structure is above). I know that I"m going to run an activity on Row add, but, I have difficulties getting this ( Max(DisplayOrder) + 1 ) and populating the newly created cell.
LEt me know please if this still unclear.
Thanks,
Rosy
Thanks. Now I have more clarity on your requirement.
Basically you can calculate the Maximum using the declare expression as suggested by Gowrishankar and set that to DisplayOrder property in pyPostGridUpdate Activity. This activity should be executed in the newly added page context so you can actually place this in the pagelist property class.