web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Gallery Filtering - Ch...
Power Apps
Unanswered

Gallery Filtering - Checkbox and Textfields

(0) ShareShare
ReportReport
Posted on by 32

Hi all,

 

Some help needed please.

 

I have a gallery linked with a collection from an SP list. i am trying to add a few filtering options based on a Check Box value=true but nothing is working as it should.

 

Here is the basic filter code;

SortByColumns(Filter([@TAXICOL],StartsWith(StaffName, Name1.Text)),"DateReq", If(SortDescending1, Descending, Ascending))

 

Here is the filter code that allows me to filter based on checkbox, but the gallery doesn't show any items that does not have the value stipulated by the true statement of the checkbox;

SortByColumns(Filter([@TAXICOL],StartsWith(StaffName, Name1.Text),If(BookedYN.Value=true,Booked,"Yes")),"DateReq", If(SortDescending1, Descending, Ascending))

 

I also need a similar thing to the below code on a similar gallery but nothing works;

SortByColumns(Filter([@TAXICOL], TextSearchBox1_1.Text in StaffName || TextSearchBox1_1.Text in Schedule1 || TextSearchBox1_1.Text in Schedule2 || TextSearchBox1_1.Text in Schedule3), "DateReq", If(SortDescending2, Ascending, Descending))

Categories:
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @VegetA3113 

    You can use this formula for the items property of the gallery.

     

    With({txc: If(
     BookedYN, Filter(
     [@TAXICOL],Booked="Yes"
     ),
     [[@TAXICOL]
     )},
     SortByColumns(
     Filter(
     txc,StartsWith(
     StaffName,Name1.Text
     )
     ),"DateReq", 
     If(
     SortDescending1, Descending, Ascending
     )
     )
    )

     

    This formula starts by creating a temporary table (txc) that is either filtered or not depending on the checkbox status.  Since BookedYN is either true or false, no If() statement is required. 

    The temporary table is then used in the subsequent filter and sort.   

    With respect to your second issue, I have no idea what you mean by a "similar thing". 

  • VegetA3113 Profile Picture
    32 on at

    Thanik you for your reply.

     

    I actuially managed to get mine to work.

     

    I did try the code but it had quite a few red squiggles, I tweaked it to this, the only error now is the bold =;

     

    With({txc:If(BookedYN_2.Value=true, Filter(TAXICOL,Booked="Yes"),TAXICOL)}, SortByColumns( Filter( txc,StartsWith(StaffName,Name1_2.Text)),"DateReq",If( SortDescending1, Descending, Ascending)))

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @VegetA3113 

    A checkbox is either true or false.  If you are storing your data in some other way, ie. "Yes" instead of true, you will get errors.  While you didn't mention it, if your column type is Yes/No, it causes problems, to simplify, make it a single line of text (SLOT) instead and store the actual value provided by the checkbox. The only column types that I use in SharePoint are SLOT, date/time and numbers.  The rest cause problems in PowerApps and work-arounds are required. 

  • VegetA3113 Profile Picture
    32 on at

    Ok understood.

     

    I have changed the SP column as you stated and the values are now true or false instead of yes/no. The code still shows many squiggly red error lines though.

    1.PNG

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 243 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 204 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard