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
Super User

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 Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Top Solution Authors
Top Kudoed Authors
Users online (1,127)