Question

How to populate distinct values in Dropdown while using D_pyUserWorkList data page to populate dropdown

Hi,

I have a requirement to show distinct values ​in drop down which is sourced from D_pyUserWorkList data page ​column, I am already getting unique records only from report definition. but, I am not able to find a way to show distinct values from DP Column.

Do you have any solution to achieve this?

Thanks,

Mohammad.

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

Correct Answer
November 1, 2017 - 3:13am

used javaScript to filter the duplicate values and populate the data page to refer on dropdown.

Comments

Keep up to date on this post and subscribe to comments

October 5, 2017 - 12:00pm

Hi Mohammad,

The Data Page D_pyUserWorkList is sourced with the pyUserWorkList report definition and the parameters passed in the Data Page are:

UserId -> pxRequestor.pyUserIdentifier

WorkGroup -> pyDisplayHarness.pyActiveWorkGroup

When i ran the report definition and data page, i can see the same results in both the executions.

Could you share the screenshots of both the results, along with the screenshots of configuration for your Drop down list box.

Regards

Mahesh

October 5, 2017 - 12:29pm
Response to Mahesh Midthuru

Hi Mahesh,

I don't have problem with report definition and data page population, But the problem is to load distinct values on dropdown. lets say I am referring pxurgencyassign propery value in dropdown from 'D_pyUserWorkList', I am getting same urgency number "10" displayed 5 times in dropdown as I have 5 records in datapage with 10 as urgency. but I need to display value 10 only 1 time in dropdown.

October 6, 2017 - 4:18am
Response to MohammadS4753

Hi Mohammad,

Dropdown list will just display the data what you source in the Page List, so you have to remove the duplicate records in D_pyUserWorkList page list based on pxUrgencyAssign property before you source it to drop down. To remove the duplicate records in a page list based on a property you can have a look into the sample usecase as attached.

Hope this will help you to achieve your requirement.

Regards

Mahesh

October 6, 2017 - 10:29am
Response to Mahesh Midthuru

Thank you Mahesh, I don't think it solve my issue. this is altering the data page, I should not alter the DP, as even my urgency values are same for some records, records of DP are not same. I need all records to display on user assignments. at the same time, I need to populate refinsname of DP on other dropdown column. if I alter DP, i wont get correct results to show on refinsname​ dropdown.

October 6, 2017 - 11:04am
Response to MohammadS4753

Hi Mohammad,

If you want both duplicate and unique records then you can copy the original page list into the Temporary Page List and then apply my usecase to remove the duplicates in the Temporary Page List. Now you can use original page list and unique page list(temporary) for both the requirements., because i don't see any option to hide/remove remove duplicates at the Dropdown control level so you need to eliminate the duplicates before you source the data page to drop down control.

Hope this might help you.

Regards

Mahesh

October 8, 2017 - 3:41am
Response to Mahesh Midthuru

So, if I have 10 dropdowns to display distinct values, do I have to create 10 temp pages and display the values? 

October 11, 2017 - 2:30am
Response to MohammadS4753

@Mohammad, in your case the records are not duplicate but the specific column has the duplicate values and you want to use this column for the drop down list. Also, you need both the original page list and the records which doesn't have the duplicate values for pxUrgencyAssign field. So at the bottom line of the above requirement you need to eliminate the duplicate values of pxUrgencyAssign field from the original page list using above code or removeDuplicatesFromList ootb RUF, as i don't see any option to remove duplicates at the UI level.

October 26, 2017 - 2:41am
Response to MohammadS4753

If I understand your usecase correctly, you're trying to achieve filtering using a dropdown control. If you wish to continue using dropdwon, you'll have to create as many distinct lists as the number of dropdowns. Alternatively, you can use grid filters which already does this job of identifying unique values and let the users filter based on the filer selection.

November 1, 2017 - 3:13am

used javaScript to filter the duplicate values and populate the data page to refer on dropdown.

November 2, 2017 - 6:25am
Response to MohammadS4753

@Mohammad, it would be helpful to other users if you share your custom code for get the distinct values from page list.

November 15, 2017 - 11:59pm

if using from mobile:

Created a data page to populate the data page on dropdown.

function D_DropDown( dpPage, params ){

var cc=pega.u.ClientCache;

var DropDownpg = dpPage.put( "pxResults",[] );

var WLIter = cc.find("D_WorkList.pxResults").iterator();

var temp = new Array();

while(WLIter.hasNext()){

var WLPg = WLIter.next();

var tempCSName= WLIPg.get("pxurgencyassign").getValue();

var isCSThere = temp.indexOf(tempCSName);

if( isCSThere == -1)

{

WLPg.put("CSName",tempCSName);

DropDownpg.add().adoptJSON(WLPg.getJSON());

temp.push(tempCSName);

}

}

}

 

if using from desktop:

Write a Data transform to load data page with parameters,

Loop through the source page list, Append the values from source to primary page if parameter mached with a when condition "!(@Utilities.IsInPageList(parameter,"property",pagelist))".