How to remove duplicate entries thats populating in a dropdown.

0
We are trying to enter employee id and fetch employee list from database. List appears in the dropdown. But the issue is, we are getting duplicate entries of employee list. 1. Tried adding a decision to filter the duplicates:  $user != empty, Didn't work 2. Added union operation to filter unique users, Didn't work       Please assist on the issue.
asked
4 answers
1

Hi Rachana,

you can use my this module

https://marketplace.mendix.com/link/component/222662

it contains java action called uniquelist , in this pass your list of objects and attributename based on which list should be unique like employeeNo or something based on your domain model

change datasource type from database to microflow and use this java action and return the output of java action

 

answered
0

Hi Rachana,

you can use OQL to get the distinct records in  microflow

SELECT DISTINCT column1,column2.. FROM yourmodulename.entityname

https://docs.mendix.com/refguide/oql

download oql from here Mendix Marketplace - OQL

answered
0

Hi Rachana,

 

If you want to avoid duplicate entries, then you must identify which attributes your business classifies as unique. I think for Employee master maybe Employee Id will be Unique id.

 

Create one Empty list first then Retrieve your records from the Employee Entity from database and iterate/loop over them one by one. Use the Find by expression list operation for new list inside the loop and make constraint like $iteratorEmployee/EmployeeId != $currentObject/EmployeeId if true then change list with add iterator object else continue this way you will get unique list. 

 

But make sure add unique constrain for unique field to overhead these kind of issues.

 

Hope it Helps!

Thanks & Regards,

Manikandan K

answered
0

Rachana,

If you are using Union, then there are no duplicates in the resulting list.  Seems like maybe there is something else causing this behavior.  Can you share more about your domain model, the microflow you have created and the page / reference selector configuration?

Thanks,

Mike

answered