Posted: 6 Jan 2017 6:11 EST Last activity: 8 Jun 2017 5:41 EDT
How to populate distinct values in Dropdown
I have a requirement to show distinct values in a dropdown.Could you guide me how to achieve this. I have followed below two methods to populate the values in dropdown and able to see the data in dropdown. This is showing all the values.:
I have created a data page with structure as list.
Created an Activity in Code-Pega-List class using Obj-Browse method and referred the above Data Page under Page Name.
Refered the above Activity in the data page under source -> Activity.
In Dropdown- settings - General - List Source -Type -DataPage - Referred the above Data page.
Method 2 :
Created an Activity in work class using Obj-Browse method.
Referred the above activity in Dropdown- settings - General - List Source -Type -Clipboard page.
Now, how and where i need to control the dropdown to get only distinct values.
You can create the ReportDefinition with source column and check the Remove duplicate rows option to load unique values. Now refer the RD as datepage source. Refer attached screen print remove duplicate configuration.
Otherwise refer the pyRemoveDuplicatesFromPagelist and use same code in activity as java step and remove the duplicates from given pagelist.
Can you please share the complete use case along with the test result for us, so that it can be helpful in our further investigation to find the root cause. Also share the PRPC version you are using. Thank you.
Posted: 4 years ago
Posted: 6 Jan 2017 18:10 EST
Susan Liu (SusanLiu_GCS)
Principal Software Solutions Engineer
The Dropdown can be configured using a data page / report definition / clipboard page.
Please refer to DesignerStudio -> User Interface -> UI Gallery -> Dropdown examples.
In terms of populating distinct values in Dropdown, I second Praveen's opinion, using Report Definition (with "Remove duplicate rows" checkbox checked) is the best choice. You can create a data page with Report Definition as its data source.
As far as i know, 'Remove duplicates rows' in RD will work for the above requirement if there is only column in RD, if there are more than on column, it will remove duplicates with the combination of all columns treating as a single row and will remove only if the same combination exists.
Col 1 Col 2 Col 3
AAA BBB CCC
AAA CCC BBB
CCC AAA BBB
In this case though we have duplicates in column 1 and column 3, it will not remove duplicates as the three column combination is unique. If we have to remove duplicates in each column, how can we achieve this?