cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Filter records with multi select option set values

I have an entity(User Bookings)) in CDS and created a field(Service Type) of type Multi Select Optionset with values "Appointment", "Phone Call", "F2F"

 

And then now Imported some records to the entity with Multi select Optionset field data populated.

 

Now in Canvas App I want to load Gallery with only records where Service Type in ("Appointment", "Phone Call")

 

Could you help me how to filter records based on multi select optionset field data.

 

Thanks

 

Surender

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

Re: Filter records with multi select option set values

Hi @jhall 

 

Here is my requirement and what I have,

 

I have an entity "User Bookings" and in that entity I have various fields and one of them is Multi select optionset named "Service Type" which got values "Appointment", "Phone Call" and "F2F".

 

I want to fill gallery with all User Bookings records where Service type eq "Appointment" or "Phone Call".

 

The query you posed helped me some where and at last understood the logic around the query and here is the final query that works.

 

ClearCollect(MyCol, Filter('User Bookings', CountRows(Filter('Service Type', Value = [@'Service Type'].Appointment Or Value = [@'Service Type'].'Phone Call'))>0))

 

Many Thanks

 

Surender

View solution in original post

6 REPLIES 6
Highlighted
Continued Contributor
Continued Contributor

Re: Filter records with multi select option set values

Something similar to:

  • Filter(myGallery, Or("Appointment" in ServiceType,"Phone Call" in ServiceType))

But you'd probably want to make this dynamic based on items you're selecting for the Filter (e.g. de-select "Appointment", select "F2F", etc.).

Also, depending upon the size of your list you're sorting through, you might want to do a pre-filter before you're even populating whatever is filling your Gallery (myGallery in my example above).

Highlighted
Frequent Visitor

Re: Filter records with multi select option set values

Hi @jhall ,

 

Thanks for your reply.

 

I have updated my query now like this:

ClearCollect(MyCol, Filter('User Bookings',Or([@'Service Type'].Appointment in 'Service Type'.Value, [@'Service Type'].'Phone Call' in 'Service Type'.Value)))

 

It is not erroring but not displaying anything. I have tried 'Service Type' after in operator as well. Any idea of what am I missing?

 

Thanks

 

Surender

Highlighted
Continued Contributor
Continued Contributor

Re: Filter records with multi select option set values


@Surender wrote:

ClearCollect(MyCol, Filter('User Bookings',Or([@'Service Type'].Appointment in 'Service Type'.Value, [@'Service Type'].'Phone Call' in 'Service Type'.Value)))

 


Thaaaat doesn't look right.  I think you've got those reversed, but let me clarify.  What control contains the items you're selecting to search for and what is the name of your data source? 

I am assuming you're doing a search where the user selects criteria X and then you filter the list to only show items where X is true.  Without the names of your controls and data source I'm not sure if you've got this written out correctly.

Highlighted
Frequent Visitor

Re: Filter records with multi select option set values

Hi @jhall 

 

Here is my requirement and what I have,

 

I have an entity "User Bookings" and in that entity I have various fields and one of them is Multi select optionset named "Service Type" which got values "Appointment", "Phone Call" and "F2F".

 

I want to fill gallery with all User Bookings records where Service type eq "Appointment" or "Phone Call".

 

The query you posed helped me some where and at last understood the logic around the query and here is the final query that works.

 

ClearCollect(MyCol, Filter('User Bookings', CountRows(Filter('Service Type', Value = [@'Service Type'].Appointment Or Value = [@'Service Type'].'Phone Call'))>0))

 

Many Thanks

 

Surender

View solution in original post

Highlighted
Continued Contributor
Continued Contributor

Re: Filter records with multi select option set values

Well, glad I sorta-helped.  Good luck!  Smiley LOL

Highlighted
Community Support
Community Support

Re: Filter records with multi select option set values

Hi @Surender ,

Have you solved your problem?

 

I agree with yout thought almost. If you have solved your problem, please go ahead to click "Accept as Solution" to identify this thread has beed solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,032)