cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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

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

Proud to be a Super User!

Regards,
KrishnaV
Business Applications MVP
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.

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.

Proud to be a Super User!

Regards,
KrishnaV
Business Applications MVP
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
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (28,139)