Discussion

Eliminate duplicates from pagelist.

Hi,

I need to display employee-id's in an autocomplete control from a data table which is having a composite key(combination of emp-id+other two columns).

I have used Obj-Browse and got a page with pxresults(). This list is having duplicate values.

Please suggest me some approaches to eliminate the duplicates.

Thanks,
Kiran.

**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

January 28, 2011 - 3:29pm

quote:


Originally posted by KIRAN261280

I tried using removeDuplicatesFromList(cp,kp,class) which is having three parameters(A clipboard page,Key Property and class).

Now my method looks like this

@removeDuplicatesFromList(EmplKinResultPage,LPClass.AssoiciateKIN,LPClass)

I am passing the page which was created using Obj-Browse. For ex : EmplKinResultPage which in turn contains pxResults() which contains 9 results from pxResult(1)........pxResult(9).

And LPClass is the data class from which I am fethcing the records.

I am assigning the resulting listPage to a pagelist property of the same LPClass.

I think I am doing something wrong in assigning the params and values.

Please assist.

Thanks,
Kiran.


Example: ResultsPage.pxResults

ResultsPage - Code-Pega-List
pxResults - Data-Admin-Operator-ID

@removeDuplicatesFromList(ResultsPage,"pyUserIdentifier", "Data-Admin-Operator-ID")

January 10, 2011 - 7:04am

Try using utility function removeDuplicatesFromList

January 10, 2011 - 9:32am

I tried using removeDuplicatesFromList(cp,kp,class) which is having three parameters(A clipboard page,Key Property and class).

Now my method looks like this

@removeDuplicatesFromList(EmplKinResultPage,LPClass.AssoiciateKIN,LPClass)

I am passing the page which was created using Obj-Browse. For ex : EmplKinResultPage which in turn contains pxResults() which contains 9 results from pxResult(1)........pxResult(9).

And LPClass is the data class from which I am fethcing the records.

I am assigning the resulting listPage to a pagelist property of the same LPClass.

I think I am doing something wrong in assigning the params and values.

Please assist.

Thanks,
Kiran.

January 10, 2011 - 8:05pm

Use the following code as example for your requirement.

ClipboardPage pyStateList= tools.findPage("stateList");
if(pyStateList != null) {
pega_rules_utilities.removeDuplicatesFromList(pyStateList, "pyFieldValue", "Rule-Obj-FieldValue");
}

Hope this helps.

January 11, 2011 - 9:26am

Hi,

Can I ask you something? Like on what ground are you saying you're having duplicates? The two similar pages, don't they have different primary keys in the Data table?

Thanks & regards,
arka

January 20, 2011 - 9:59am

Hi

You can create a PageGroup , iterate over your PageList and than assign value in your PageGroup.

PageGroup cannot contain duplicate values so your duplicate values will be overwritten.

quote:


Originally posted by KIRAN261280

Hi,

I need to display employee-id's in an autocomplete control from a data table which is having a composite key(combination of emp-id+other two columns).

I have used Obj-Browse and got a page with pxresults(). This list is having duplicate values.

Please suggest me some approaches to eliminate the duplicates.

Thanks,
Kiran.


May 5, 2011 - 12:02pm

@removeDuplicatesFromList(ResultsPage,"pyUserIdentifier", "Data-Admin-Operator-ID")

Above code worked for me.
Thanks

September 8, 2014 - 2:31pm

How are you using this in Activity step ?

 

February 18, 2015 - 9:10am

to call the "removeDuplicatesFromList" function, you can include a JAVA step in your activity and call this function as below with appropriate parameters.

 pega_rules_utilities.removeDuplicatesFromList(listPage, keyProp , className);

July 21, 2016 - 5:09am

Hi I have tried to remove the duplicates from page list but getting lot of errors.

my Code-Pega-List page name is ABC , there a duplicate prop( FirstName)   Value on page ABC.pxResults and the class name is P-Q-R .

I passed the parameters like @removeDuplicatesFromList(ABC, .FirstName ,P-Q-R) and tried with another way (ABC.pxResults,.FirstName,P-Q-R) .

In both the cases i got an error like "-" is not allowed. 

what i have to do.

 

Thanks in advance.

July 22, 2016 - 6:15am
Response to ArunGadda

you can explore "pyRemoveDuplicatesFromPagelist" as well. Call this in activity with Call-Function method.

@( Pega-RULES:Utilities).pyRemoveDuplicatesFromPagelist(ABC,".pxResults","FirstName")

July 22, 2016 - 6:08am

have java step in activity with step page as list page and add below line code - 

pega_rules_utilities.removeDuplicatesFromList(myStepPage, ".FirstName", "Code-Pega-List");

Here "code-pega-list" is page list class