cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LewisFoulger
Helper II
Helper II

Simple filter i cant get my head around!

LewisFoulger_0-1660039227474.png

I am trying to filter this gallery,

 

Basically what I'm trying to do is If the text box is blank, show all items, if not blank find the record using the search box by searching for the ID.

1 ACCEPTED SOLUTION

Accepted Solutions
iAm_ManCat
Super User
Super User

Filter(
       'Non Conformance',
        IsBlank(GallSearch.Text)
        ||
        ID = Value(GallSearch.Text)
)

 

That should cover it, let me know if you run into any issues with it

 

Cheers,

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


View solution in original post

3 REPLIES 3
iAm_ManCat
Super User
Super User

Filter(
       'Non Conformance',
        IsBlank(GallSearch.Text)
        ||
        ID = Value(GallSearch.Text)
)

 

That should cover it, let me know if you run into any issues with it

 

Cheers,

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Cheers worked perfectly dunno what direction i was taking it. what is the "||"?

Sure, happy to explain!

 

These are better ways to represent the And() function as && and the Or() function as ||

 

Some people might disagree with me, but in terms of readability once you have multiple layers of Ands and Ors, then having them split with these instead of going back up to each And/Or wrapper to figure it out makes them read like a sentence isntead of a nightmare:

 

 

(
   (ThisItem.Value=1) 
   || 
   ( Textbox1.Visible && Datepicker.SelectedDate=Today() )
)
&&
(DevMode = true)

 

Or this:

 

And(
   Or(ThisItem.Value=1, 
      And( Textbox1.Visible, Datepicker.SelectedDate=Today() )
   ),
   (DevMode = true)
)

 

 

Additionally, in much larger formulae, the And() Or() functions can break - I mean really really larger with ten or more layers of and-in or-ing, and in that case using && || doesn't pass those values to a function and instead interprets them directly as boolean logic in your formula

(This likely to not be a case for most people, but in truly large complex apps its a consideration)

 

Cheers,

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (2,048)