Posted: 15 Jul 2015 6:31 EDT Last activity: 16 Nov 2016 6:22 EST
Remove Duplicate values in Pagelist using same pagelist
I am fetching the values from internal data table.
I have a page list A.pxResults(100) which contains 100 embedded pages, in each embedded page has 10 properties with values
Now I need to remove duplicates by comparing with all the 10 properties (AND condition applies for all these 10 properties) and these 10 property values are from the page list only...
Like first take A.pxResults(1) page and check in the complete page list of A... there after A.pxResults(2) and check inthe complete page list of A and if found any duplicate then delete it.
I gues I cannot use the functions IsInPagelist or RemoveDuplicatesFromList as i need to compare all the values of page list with the same pagelist and all the property values in the page should be same when compared before deleting.
This is continuation to the above given scenario where if 5 specific property matches and the other 5 are not matching.
the 5 specific properties which may contain Organisation, Division, Unit, EMPID and Name and other 5 conatins some request parameters.
if the 5 values are same in the list with 50 records then we need to delete them in the A.pxResults and copy it into B.pxResults(which means in total of 100 records if the EMPID with 123456 has 50 records with different requests). Here the limit is 50 records, if it crosses 50 then its should delete the pages or mark something in the page and copy the entire list into another Pagelist and if it is less, then normal process should continue.
You may also try below approach to remove duplicate pages in a PageList. For this we have to iterate pagelist inside the same pagelist.
say PageList - PoliciesList
Each page has 10 attributes. so add one more property on each page say 'IsDuplicate'
1. Start looping ForEachEmbeddedPage on 'PoliciesList' check pre-condition as 'IsDuplicate' is != 'No' and in first step set 'IsDuplicate' as 'No' and build a string all the properties seperating by a delimiter and set it to a Parameter.
2. start looping the same pagelist 'PoliciesList' inside the iteration. Check Pre-Condtion as 'IsDuplicate' is NULL and compare the String of properties on this page with the main string from Outer Iteration and if they match set 'IsDuplicate' as 'Yes' on that page.
3. at the end of the Iteration you have value to 'IsDuplicate' on each page.
4. Use Obj-Sort and on the 'PoliciesList' pagelist and remove pages with 'IsDuplicate' as 'Yes'