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
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
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 Apps Community Call

Monthly Power Apps Community Call

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

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (37,215)