Discussion

Copy Values from one Page List to other

My Requirement :

I want to copy data from one page list to other(both of same class) but eliminating the duplicate property values from first page list to second.
Example :

Pagelist1(1).Area = "TN"
Pagelist1(2).Area = "TN"
here i need to ignore the duplicates and just copy

Pagelist2(1).Area = "TN"

Please provide suggestions.

Thanks in advance.

**Moderation Team has archived post**

This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.

Comments

Keep up to date on this post and subscribe to comments

November 29, 2011 - 4:49am

@SWAMIS01 :
I tried as per your code..but getting "Null pointer Exception"
I used like below, please tell if any errors.

ClipboardPage TerstBVCRelationshipParent = tools.findPage("pyWorkPage.TerstBVCRelationshipParent");

pega_rules_utilities.removeDuplicatesFromList(TerstBVCRelationshipParent, "Label", "MHS-FW-Adv-Data-BP-Relationship");

November 29, 2011 - 8:07am

Hi
I think Page "pyWorkPage.TerstBVCRelationshipParent" doesn't have pxResultCount Property.so you are getting null pointer exception.

First browse the results from data table(or DB)on Top level page like(MarketDetailsPage) and then in the 2nd step remove the duplicates using RUF removeDuplicatesFromList and then in the 3rd step copy these results into your pyworkpage.

let me know if you need any information

November 28, 2011 - 3:57am

while copying the property, use pre-condition to compar the values. If same skip the step.

November 28, 2011 - 4:04am

@PRASADDURGA: I Tried using @PRASADDURGA, but i cant refine the values.. can you please elaborate -

Thanks

November 28, 2011 - 4:18am

By using ForEachEmbedded page, iterate the pagelist, and compare the present value with all values in page list. If value is exist in page list, skip the step.

November 28, 2011 - 4:37am

@PRASADDURGA : Can you please tell how to compare the presant value in PageList1 with all the values in PageList2 (Intially it will be NULL), beacuse I got struck there only.

November 28, 2011 - 4:46am

From where yoy are getting the data to PageList?

November 28, 2011 - 4:51am

I make a Obj-Open to get the results and populate the same in page list. Is it possible to filter ther itself ??

Please help me out.

November 28, 2011 - 4:55am

If the value is NULL, just skip the step.
Not NULL, Compar as useval.

November 28, 2011 - 5:02am

PageList getting the data from Interna DataTable?

November 28, 2011 - 5:22am

Ya, getting values from Pega DB..

November 28, 2011 - 8:35am

Hi

After copying the data to second pagelist use the OOTB function
removeDuplicatesFromList in the Java step to remove the duplicates from the pagelist

JAVA CODE:

Ex:
ClipboardPage MarketDetailsPage= tools.findPage("MarketCode");

pega_rules_utilities.removeDuplicatesFromList(MarketDetailsPage, "Property Name to be filtered", "DATA CLASS NAME" );

pega_rules_utilities.removeDuplicatesFromList(reportListPage, "Industry", "Data-Model-XXX" );

November 28, 2011 - 8:43am

@SWAMIS01 : Thanks
Will try

Pega
November 10, 2016 - 11:49am

Use Append and MapTo  option in DT if source page list and target page list are of different class

Use Append  option in DT if source page list and target page list are of same class

Reference https://pdn.pega.com/introduction-data-transforms/introduction-data-transforms

This avoids use of Activities and it worked for me :)