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

Using a variable to filter a Two Option set in CDS

Hi 

 

I'm new to PowerApps so please bare with me. 

 

I'd like to filter a Gallery based using a variable

 

My app is using the CDS with various field types, some of which are Two Option sets. I've figured out how to filter based on the Two Option set data type, but I can't figure out how to use a variable as part of the item property of my gallery.

 

This is the basic filter:

 

Filter(Alerts, Acknowledge = 'Acknowledge (Alerts)'.Yes)

 

I'd like to use a variable to set the value I filter on though, for example: 

 

Filter(Alerts, Acknowledge = 'Acknowledge (Alerts)'.VAR1)

 

the example variable command doesn't work, can anyone help? 

 

thanks in advance 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Using a variable to filter a Two Option set in CDS

Hi @Dr_David_Banner ,

I was only using your code in the correct syntax. You are correct with the Delegation issues with the In Filter, although this is a separate issue from using a variable to filter in general.

I am not a CDS user, but I would have thought the syntax would be

Filter(Alerts, VAR1 In Acknowledge) 

I found this post that may be useful for you.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

4 REPLIES 4
Highlighted
Super User III
Super User III

Re: Using a variable to filter a Two Option set in CDS

Hi @Dr_David_Banner ,

You just need to reference the Variable like this

Filter(
   Alerts, 
   Acknowledge = VAR1
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Highlighted

Re: Using a variable to filter a Two Option set in CDS

Thanks Warren

 

I tried this originally, but I get an error saying the datatype doesn't match, because I am using a "Two Option set" . I can change the filter to say 

 

Filter(Alerts, Acknowledge in "VAR1")  

 

which does work but, "in" is not a supported delegated lookup with the CDS so its not very efficient and may cause me issues down the road

 

thanks

Highlighted
Super User III
Super User III

Re: Using a variable to filter a Two Option set in CDS

Hi @Dr_David_Banner ,

I was only using your code in the correct syntax. You are correct with the Delegation issues with the In Filter, although this is a separate issue from using a variable to filter in general.

I am not a CDS user, but I would have thought the syntax would be

Filter(Alerts, VAR1 In Acknowledge) 

I found this post that may be useful for you.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

Highlighted

Re: Using a variable to filter a Two Option set in CDS

Thanks, I'll use the in function for now, perhaps there isn't a more efficient way of doing what I am after

 

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (9,798)