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

Filter failing with certain combinations of conditions

I'm trying to filter a gallery, but a particular combination of conditions is returning no results, even though they work independently. I've confirmed in SQL that records exist that meet all the conditions. For context, I have it wrapped in a switch function with a couple extra dropdowns for my app, but the problem still exists when pared all the way back.

 

This works:    
Filter( 'DataSource',
Condition1 = true,
Condition2 = false)

 

This works:

Filter( 'DataSource',
If(IsEmpty(DropDown.SelectedItems), true, DropDown.Selected.Code = Code),
Condition1 = true,
Condition2 = true)

 

But this returns no records, even when the dropdown is left blank:

Filter( 'DataSource',
If(IsEmpty(DropDown.SelectedItems), true, DropDown.Selected.Code = Code),

Condition1 = true,
Condition2 = false)

1 ACCEPTED SOLUTION

Accepted Solutions
AParker
Frequent Visitor

Hi Krishna, thanks for your response. Spending more time with it I realized it was due to a delegation error, rewriting the code as follows removed the error and fixed the search. Leaving this here in case it helps someone else!

 

If(IsEmpty(dropdown.SelectedItems),

Filter('datasource', Condition1=true, Condition2= false),

Filter('datasource', dropdown.Selected.Code = Code, Condition1= true, Condition2=false))

View solution in original post

3 REPLIES 3
KrishnaV
Super User III
Super User III

Hi @AParker ,

 

Sorry I don't see any difference between 2 Filter and the one you want to fix (unless my cheated me for some reason 😊 ).

also, may I know what is condition1=true? means the logical condition true?


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to help.

Regards,
Krishna
If this post helps give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.
AParker
Frequent Visitor

Hi Krishna, thanks for your response. Spending more time with it I realized it was due to a delegation error, rewriting the code as follows removed the error and fixed the search. Leaving this here in case it helps someone else!

 

If(IsEmpty(dropdown.SelectedItems),

Filter('datasource', Condition1=true, Condition2= false),

Filter('datasource', dropdown.Selected.Code = Code, Condition1= true, Condition2=false))

View solution in original post

Hi @AParker ,

 

If the issue is resolved could you please mark the relevant reply as the solution so that it will be useful to the new members in the community.

 

Regards,
Krishna


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors
Users online (2,130)