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 / Filter a a gallery by ...
Power Apps
Suggested Answer

Filter a a gallery by text from list

(0) ShareShare
ReportReport
Posted on by 4
Hi
 
Can someone advise on what is the error in my formula.
 
I have a text box, where if you type something from Column 1 it brings up all records related to it OR if you type something from within Column 2 it brings up all records related to it.
 
 
Filter(
    'LIST RESPONSE TITLE',
    StartsWith(
        Name,
        txtSearchRecords.Text)
)
    StartsWith(
        Supervisor,
        txtSearchRecords.Text)
)
 
 
 
I get 3 errors with this formula. 
 
Expected Operator when hovering over StartsWith
 
Name isn't valid when hovering over Supervisor (This is the exact name of the column in the list)
 
Then when hovering over the comma after supervisor, i get unexpected character error.
 
I basically would like someone to be able to type a Name into the search box, or a supervisor name and it be able to bring up all records relating to that name or supervisor.
I have the same question (0)
  • MarkRahn Profile Picture
    1,397 Super User 2026 Season 1 on at
     
    I think you are missing "||" (double pipes for an OR condition) after the first StartsWith().
     
    Filter(
        'LIST RESPONSE TITLE',
        StartsWith(
            Name,
            txtSearchRecords.Text)
         ||
        StartsWith(
            Supervisor,
            txtSearchRecords.Text)
    )
     
    This community is supported by individuals freely devoting their time to answer questions and provide support. They do it to let you know you are not alone. This is a community.

    If someone has been able to answer your questions or solve your problem, please click Does this answer your question. This will help others who have the same question find a solution quickly via the forum search.

    If someone was able to provide you with more information that moved you closer to a solution, throw them a Like. It might make their day. 😊

    Thanks
    -Mark
  • Suggested answer
    MS.Ragavendar Profile Picture
    7,305 Super User 2026 Season 1 on at
     
    With(
        { searchText: Trim(txtSearchRecords.Text) },
        If(
            IsBlank(searchText),
            'LIST RESPONSE TITLE',
            Filter(
                'LIST RESPONSE TITLE',
                StartsWith('Name', searchText) ||
                StartsWith(Supervisor, searchText)
            )
        )
    )
     
    ✅If this helped, please Accept as Solution to help others ❤️ A Like is appreciated 🏷️ Tag @MS.Ragavendar for follow-ups.
  • EL-11061321-0 Profile Picture
    4 on at
    so this:
     
    With(
        { searchText: Trim(txtSearchRecords.Text) },
        If(
            IsBlank(searchText),
            'Non Manufacturing Induction Responses',
            Filter(
                'Non Manufacturing Induction Responses',
                StartsWith('EmployeeName', searchText) ||
                StartsWith('Supervisor, searchText)
            )
        )
    )
     
    Throws up a few different errors
     
    With( - Expected Boolean Value
    StartsWith('EmployeeName', searchText) || -Delegation warning. The "StartsWith" part of this formula might not work correctly on large data sets.
    StartsWith('Supervisor, searchText)
            ) - 
    Invalid number of arguments: received 1, expected 2.
    Expected closing of identifier. We expect a closing (') at this point in the formula.
    Name isn't valid. 'Supervisor, searchText)' isn't recognized.
     
  • MarkRahn Profile Picture
    1,397 Super User 2026 Season 1 on at
     
    Your answer is much more complete than mine. I like the use of "With()" to prevent the need for double evaluation of "Trim()".
     
    Thank you for sharing your knowledge with others.
     
    -Mark
  • CU12061030-1 Profile Picture
    2 on at

    Your formula needs to combine both conditions with an Or inside the Filter. Try this structure:

    Filter(
        'LIST RESPONSE TITLE',
        StartsWith(Name, txtSearchRecords.Text) || 
        StartsWith(Supervisor, txtSearchRecords.Text)
    )
     

    This way, it will return records where either the Name or Supervisor starts with the search text.   ConcoraCard

     
  • MS.Ragavendar Profile Picture
    7,305 Super User 2026 Season 1 on at
    @MarkRahn, i cannot take the credits completely because i too follow the approach like you initially after referring blogs from @WarrenBelz I follow the approach which is more friendly.
  • MarkRahn Profile Picture
    1,397 Super User 2026 Season 1 on at
     
    That is awesome! @WarrenBelz is who taught me about how to use the "With()" function as well.
     
    I'm glad to have a community with both of you in it.
     
    -Mark
  • WarrenBelz Profile Picture
    155,660 Most Valuable Professional on at
    Thank you for the endorsement on the With() Statement (my blog is here).
     
    It is generally "my best friend" in dealing with a multitude of situations efficiently. Power Apps however on quite rare and seemingly random occasions seems want to give Delegation warnings (this is the second one I have seen - the most common is some date calculations) with "pre-calculated" values being used in otherwise Delegable filters.
     
    The one you have can be solved in two ways - ignore the Trim() (I have never bothered with it). Note also if you set the Default of txtSearchRecords to "" (empty string), you do not need the blank test - it will return all records until something is put in there. This is @MarkRahn's original post and is correct (so please mark accordingly)
    Filter(
       'Non Manufacturing Induction Responses',
       StartsWith(
          'EmployeeName', 
          txtSearchRecords.Text
       ) ||
       StartsWith(
          'Supervisor, 
          txtSearchRecords.Text
       )
    )
    OR set the OnChange of txSearchRecords to
    UpdateContext({varSearch: Trim(Self.Text)})
    and then the Filter
    Filter(
       'Non Manufacturing Induction Responses',
       StartsWith(
          'EmployeeName', 
          varSearch
       ) ||
       StartsWith(
          'Supervisor, 
          varSearch
       )
    )
    Also set the DelayOutput to true
     
    This will allow @MS.Ragavendar's suggestion to work with Delegation.
     
    Please Does this answer your question 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 answering Yes to Was this reply helpful? or give it a Like
    Visit my blog
    Practical Power Apps    LinkedIn  
     
  • EL-11061321-0 Profile Picture
    4 on at
    @MS.Ragavendar@MarkRahn@WarrenBelz 

    I cannot thank you all enough!!


    @WarrenBelz  -  This is the one that finally did it
     
    You would not believe how long I have been banging my head against a wall with this one (I am new to PowerApps and self taught so its probably not surprising) Copilot couldn't fix it, other google/forum answers couldn't fix it. Posting here was my last ditch attempt.
     
    It's now finally working - appreciate everyone who took the time to reply :)
     
    Filter(
       'Non Manufacturing Induction Responses',
       StartsWith(
          'EmployeeName', 
          txtSearchRecords.Text
       ) ||
       StartsWith(
          'Supervisor', 
          txtSearchRecords.Text
       )
    )

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 392

#2
WarrenBelz Profile Picture

WarrenBelz 364 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 271 Super User 2026 Season 1

Last 30 days Overall leaderboard