Question
Virtusa
IN
Last activity: 6 Oct 2022 13:38 EDT
Sort pyWorkParty
Hello,
I have a requirement where I need to sort pyWorkParty based on party role.
I checked and came to know that since pyWorkParty is a page group, We don't have any OOTB feature to sort page groups.
Please let me know if there is a way to sort pyWorkParty page group or help me with some custom code for function.
Thanks in advance :)
-
Reply
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Updated: 6 Oct 2022 13:38 EDT
Bentego
TR
I added three rules in patch version 01-01-03 of SortpyWorkParty ruleset in attached product. Kindly import jar file in your local environment to examine the rules. It is entirely covering the requirement without breaking the other places of the application. I could not catch any bug in the happy path of testing. Basically, we have data page rule whose structure is List and mode is Read-only and configured as Reload once per interaction. Data transform associated with DP is reading the pages from the pyWorkParty page group property of work page parameter value and applying sorting logic. Data page is associated with the pyCaseAssets section rule's Participants' layout as a source and that's it. Our actual work parties source are still pyWorkParty. In case you are trying to add new parties or modify the existing, all the changes still reflected to pyWorkParty page group as well as data page which is a source of repeating layout showing the ordered work parties since DP configured as Reload once per interaction and after submitting the Update participants local action, main UI refreshed eventually updated work parties have been listed in an ordered manner.
I added three rules in patch version 01-01-03 of SortpyWorkParty ruleset in attached product. Kindly import jar file in your local environment to examine the rules. It is entirely covering the requirement without breaking the other places of the application. I could not catch any bug in the happy path of testing. Basically, we have data page rule whose structure is List and mode is Read-only and configured as Reload once per interaction. Data transform associated with DP is reading the pages from the pyWorkParty page group property of work page parameter value and applying sorting logic. Data page is associated with the pyCaseAssets section rule's Participants' layout as a source and that's it. Our actual work parties source are still pyWorkParty. In case you are trying to add new parties or modify the existing, all the changes still reflected to pyWorkParty page group as well as data page which is a source of repeating layout showing the ordered work parties since DP configured as Reload once per interaction and after submitting the Update participants local action, main UI refreshed eventually updated work parties have been listed in an ordered manner.
Output
Let me know the result whether it helps or not.
Regards.
Mert.
Bentego
TR
As far as I know, there is no OOTB method like Obj-Sort to be able to sort pages of the page group. Nevertheless, I have an idea. I will explain you in my next post. I hope it will be useful for your requirement.
Regards.
Mert.
Virtusa
IN
Any help here, please
Bentego
TR
I produced attached solution. Kindly import solution jar to your Pega Prpc personal edition in order to examine it and get the idea. I am not fully assuring this solution because I have some doubt on a one point I realized while implementing the solution. Nevertheless, it is entirely covering the "sorting pyWorkParty page group". As you know, page group property is un-ordered data structure. Normally, we should use page list properties in order to sort the items. However, it may not good idea to change participants source (OOTB property pyWorkParty) from page group to introduce page list property because it may affect all over the application, creating inconsistency as BUs able to push or delete parties from the grid so that here is the workaround.
I produced attached solution. Kindly import solution jar to your Pega Prpc personal edition in order to examine it and get the idea. I am not fully assuring this solution because I have some doubt on a one point I realized while implementing the solution. Nevertheless, it is entirely covering the "sorting pyWorkParty page group". As you know, page group property is un-ordered data structure. Normally, we should use page list properties in order to sort the items. However, it may not good idea to change participants source (OOTB property pyWorkParty) from page group to introduce page list property because it may affect all over the application, creating inconsistency as BUs able to push or delete parties from the grid so that here is the workaround.
Idea is that using temporary page list to leverage Obj-Sort method on it to sort the items by some property value of party page (pxRoleName or any other) and then delete the existing pages from the pyWorkParty page group property of work object eventually re populate the pyWorkParty page group from the ordered temporary page list. However, I realized something weird here is that let's suppose we have two work parties with the following subscript values Customer and Owner. After sorting page list by our order logic (suppose ascending Customer first and Owner second) and append it to page group same thing happened Order appeared in first line and Customer second which is not expected so that I override the Subscript value like "index" + Param.ForEachCount pattern before adding it to page group and then set the Subscript values from actual as Customer and Owner.
Although it is ordered as expected and entirely covering the requirement, there is one doubt that after changing Subscript value, value inside of parenthesis not changed and storing the pyWorkParty like pyWorkParty(index1) and pyWorkParty(index2) and etc in work object. Only the indicator changing as index1, index2 and etc. all the content of page same.
Output
Let me know the result whether solution helps or not.
Regards.
Mert.
Virtusa
IN
@m.caldag Thanks for the detailed steps,
I did checked this and it is sorting the pagelist properly but after copying from ordered pagelist to workparty group it is missing the order. I tried it with having 5 different parties.
And changing the subscript is not good at least in my requirement because I am using subscript in different logic
Bentego
TR
Hi @BATTINIRAMESH
"... but after copying from ordered pagelist to workparty group it is missing the order."
Yes, that's why we are overriding subscript value with index + Param.pyForEachCount pattern before pushing them to page group and then revert them initial exact values.
Solution I attached earlier is reverting back subscript property values to initial values if you check the page details, you will see the values, not only look paranthesis value. However, value in paranthesis remains index1, index2 and etc.
Can you share the clipboard and the exact subscript values of parties? I would like to reproduce in my local environment. When I try with Customer and Owner, it is successfully added in expected order with using "index" + Param.pyForEachCount" pattern.
Regards.
Mert.
Updated: 2 Oct 2022 1:45 EDT
Virtusa
IN
Hello @m.caldag ,
Yes, I did override subscript value with index + Param.pyForEachCount pattern before pushing them to page group and then revert them initial exact values but still issue comes when we have more party records. And I am using something like pWorkParty(Owner) in my logic, so changing subscript inside () will break the logic.
One more thing here is, We are using repeated parties. So you can try having repeated parties may be, to reproduce the issue.
Thank you :)
Bentego
TR
@RameshBattini If you push the same party (let's say pxRoleName Interested), Pega is appending end of subscript some numbers as below so in this case how are you planning to sort same repeated parties? Wouldn't you need an additional property to add order logic?
Bentego
TR
Hello @RameshBattini
In addition, I tried engine methods like below to add the parties with some Java code leveraging some classes and functions from the Engine API without manipulating the initial Subscript values. Looks like we cannot find proper work-around for it because same thing is happening either pushing Customer first or second object line is literally same in pyWorkParty property on clipboard (index + Param.pyForEachCount pattern also failed on repeated parties as you mentioned this scenario later) so I have another idea that I am going to explain on my next post. It will be better to use some data page to encapsulate pyWorkParty in its activity or data transform apply the respective sorting with using some temporary pages as before we did in initial solution. In this case, we will only touch the section rule that you are planning to show the ordered parties.. However, you should choose additional property for repeated parties as I highlighted my previous post.
Image I: Call newParty.add function for adding Customer object. Check the clipboard. Owner appeared in the first line under pyWorkParty property.
Hello @RameshBattini
In addition, I tried engine methods like below to add the parties with some Java code leveraging some classes and functions from the Engine API without manipulating the initial Subscript values. Looks like we cannot find proper work-around for it because same thing is happening either pushing Customer first or second object line is literally same in pyWorkParty property on clipboard (index + Param.pyForEachCount pattern also failed on repeated parties as you mentioned this scenario later) so I have another idea that I am going to explain on my next post. It will be better to use some data page to encapsulate pyWorkParty in its activity or data transform apply the respective sorting with using some temporary pages as before we did in initial solution. In this case, we will only touch the section rule that you are planning to show the ordered parties.. However, you should choose additional property for repeated parties as I highlighted my previous post.
Image I: Call newParty.add function for adding Customer object. Check the clipboard. Owner appeared in the first line under pyWorkParty property.
Image II: Call newParty.add function for adding Owner object. Check the clipboard. Owner appeared in the first line under pyWorkParty property. as same in image I.
Regards.
Mert.
NCS Pte. Ltd
SG
Hi @BATTINIRAMESH: Can you try to create a new page list property and use Property-Ref method. Then you can sort the list as required.
Please refer pySetOrderedChannelsList OOTB activity on similar functionality.
Thanks.
Bentego
TR
Dear @ArulDevan thank you for contribution on the topic. Your suggestion seems covering the vice versa in other words sorting the page list (configured as "Allow use as reference property in activities".) pages referred from pyWorkParty page group's pages like below.
Clipboard state after executing activity.
I created WorkPartyList page list property with configuring it as "Allow use as reference property in activities" sorted as expected. Requirement is to show those sorted changes on UI part as well. It means that this new property must be updated as source of the Participant's repeating of pyCaseAssets section and its never ending because pyWorkParty page group has a lot of references as below. Although, I am not recommending to change the source of work parties because it would make the application fragile as a lots of side issues might be revealed, you may do changes on repeating layout of participants source as well as flow action pyUpdateWorkParties and its dependents but it would definitely be risky. @BATTINIRAMESH
Dear @ArulDevan thank you for contribution on the topic. Your suggestion seems covering the vice versa in other words sorting the page list (configured as "Allow use as reference property in activities".) pages referred from pyWorkParty page group's pages like below.
Clipboard state after executing activity.
I created WorkPartyList page list property with configuring it as "Allow use as reference property in activities" sorted as expected. Requirement is to show those sorted changes on UI part as well. It means that this new property must be updated as source of the Participant's repeating of pyCaseAssets section and its never ending because pyWorkParty page group has a lot of references as below. Although, I am not recommending to change the source of work parties because it would make the application fragile as a lots of side issues might be revealed, you may do changes on repeating layout of participants source as well as flow action pyUpdateWorkParties and its dependents but it would definitely be risky. @BATTINIRAMESH
Regards.
Mert.
Accepted Solution
Updated: 6 Oct 2022 13:38 EDT
Bentego
TR
I added three rules in patch version 01-01-03 of SortpyWorkParty ruleset in attached product. Kindly import jar file in your local environment to examine the rules. It is entirely covering the requirement without breaking the other places of the application. I could not catch any bug in the happy path of testing. Basically, we have data page rule whose structure is List and mode is Read-only and configured as Reload once per interaction. Data transform associated with DP is reading the pages from the pyWorkParty page group property of work page parameter value and applying sorting logic. Data page is associated with the pyCaseAssets section rule's Participants' layout as a source and that's it. Our actual work parties source are still pyWorkParty. In case you are trying to add new parties or modify the existing, all the changes still reflected to pyWorkParty page group as well as data page which is a source of repeating layout showing the ordered work parties since DP configured as Reload once per interaction and after submitting the Update participants local action, main UI refreshed eventually updated work parties have been listed in an ordered manner.
I added three rules in patch version 01-01-03 of SortpyWorkParty ruleset in attached product. Kindly import jar file in your local environment to examine the rules. It is entirely covering the requirement without breaking the other places of the application. I could not catch any bug in the happy path of testing. Basically, we have data page rule whose structure is List and mode is Read-only and configured as Reload once per interaction. Data transform associated with DP is reading the pages from the pyWorkParty page group property of work page parameter value and applying sorting logic. Data page is associated with the pyCaseAssets section rule's Participants' layout as a source and that's it. Our actual work parties source are still pyWorkParty. In case you are trying to add new parties or modify the existing, all the changes still reflected to pyWorkParty page group as well as data page which is a source of repeating layout showing the ordered work parties since DP configured as Reload once per interaction and after submitting the Update participants local action, main UI refreshed eventually updated work parties have been listed in an ordered manner.
Output
Let me know the result whether it helps or not.
Regards.
Mert.