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 / Search multiple column...
Power Apps
Answered

Search multiple columns in SP List

(0) ShareShare
ReportReport
Posted on by 567

Hi All, 

 

I'm trying to work out how I can search multiple columns in my SP List.

 

I've tried all the usual techniques, done some research but failing to add another column.  

 

Currently my code is:

 

With(
 {WMST: 'NC MST Tracker'}, Sort(
 Filter(
 WMST,
 Or(IsBlank(TextInput1.Text),
 TextInput1.Text in 'Employee Name',
 StartsWith(
 'Employee Name',
 TextInput1.Text 
 )) && Switch(
 Gallery1_1.Selected.Value,
 "Mentor",
 Mentor,
 "AET",
 'AET Instructor',
 "MST",
 'MST Assessor',
 "All",
 All,
 true
 && Grade.Value = Gallery1_1.Selected.Value)
 ),'Employee Name',If(SortDescending1, Descending,Ascending))
)

 

I have a column called 'Cohort' - How would I add this?

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    154,924 Most Valuable Professional on at

    @AdamH ,

    You have the Switch statement in there which is doing nothing (we discussed this in a previous post - the true value at the end it simply returning all records and not filtering). You also do not need StartsWith() if you already have the in Filter as this will return the string anywhere in the record - so if the gallery value match your Grade values

    With(
     {WMST: 'NC MST Tracker'}, 
     Sort(
     Filter(
     WMST,
     Or(
     IsBlank(TextInput1.Text),
     TextInput1.Text in 'Employee Name'
     ) && 
     Grade.Value = Gallery1_1.Selected.Value &&
     Cohort = YourValueHere
     ),
     'Employee Name',
     If(
     SortDescending1, 
     Descending,
     Ascending
     )
     )
    )

    If not and you need the Switch statement to convert from your top menu buttons values, you need to add the field it is matching against (Grade)

    With(
     {WMST: 'NC MST Tracker'}, 
     Sort(
     Filter(
     WMST,
     Or(
     IsBlank(TextInput1.Text),
     TextInput1.Text in 'Employee Name'
     ) &&
     Cohort = YourValueHere &&
     (
     Gallery1_1.Selected.Value = "All" || 
     Grade.Value = 
     Switch(
     Gallery1_1.Selected.Value,
     "Mentor",
     Mentor,
     "AET",
     'AET Instructor',
     "MST",
     'MST Assessor'
     )
     )
     ),
     'Employee Name',
     If(
     SortDescending1, 
     Descending,
     Ascending
     )
     )
    )

    I am happy to explain all of the working to you so you can understand this going forward as I thought I had you on the right patch in the last couple of threads.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

     

  • WarrenBelz Profile Picture
    154,924 Most Valuable Professional on at

    Hi @AdamH ,

    Are you able to close this post now please - you might also include the final code.

  • Verified answer
    AdamH Profile Picture
    567 on at

    @WarrenBelz 

    Apologies, I forgot this was still open.

    The code used to filter items in a gallery between a toggle switch (true or false) value and a choice field (drop down multiple options) value was:

    With(
     {WMST: 'MY_SP_LIST'}, Sort(
     Filter(
     WMST,
     (IsBlank(TextInput1.Text) ||
     (TextInput1.Text in 'Employee Name' || TextInput1.Text in Cohort || TextInput1.Text in 'Payroll Number' || TextInput1.Text in iPadAsset))
     
     && Switch(
     Gallery1_1.Selected.Value,
     "Mentor",
     Mentor,
     "AET",
     'AET Instructor',
     "MST",
     'MST Assessor',
     "All",
     All,
     true
     
     && Grade.Value = Gallery1_1.Selected.Value)
     ),'Employee Name',If(SortDescending1, Descending,Ascending))
    )

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 534

#2
WarrenBelz Profile Picture

WarrenBelz 416 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 306

Last 30 days Overall leaderboard