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 box in powerapp...
Power Apps
Unanswered

Search box in powerapps gallery

(0) ShareShare
ReportReport
Posted on by 47

Hello fellow PA supporters.

 

I have a gallery with the following formula (which is working perfectly),

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

SortByColumns(
    Filter(
        RiskIssueTrackerV2,
        StartsWith(
            'Your name'.DisplayName,
            txtNameFilter.Text
        ),
        StartsWith(
            'Mitigation Owner'.DisplayName,
            txtMitigationOwner.Text
        )        
        && ('Primary Impact type'.Value = ImpactType.Selected.Value || ImpactType.Selected.Value = Blank())
        && ('Risk or Issue'.Value = RiskorIssue.Selected.Value || RiskorIssue.Selected.Value = Blank())
        && ('Risk or Issue Category'.Value = DataRiskCat.Selected.Value || DataRiskCat.Selected.Value = Blank())
       
    ),
    "ID",
    If(
        varSortDirection = SortOrder.Ascending,
        SortOrder.Descending,
        SortOrder.Ascending
    )
)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
what I want to do is add in 1 more function that allows for users to search the "title" in addition to the above fields
 
when I provide the following:
Search(RiskIssueTrackerV2,TxtTitle.Text,"Title (Risk or Issue)")
I am getting an error
My data source: RiskIssueTrackerV2
My Search box: TxtTitle.Text
Gallery search field: Title (Risk or Issue)
 
My gallery picture below:
 
PrashantParekh_0-1706283444713.png

 

Categories:
  • Ami K Profile Picture
    15,689 Super User 2024 Season 1 on at

    @PrashantParekh - You have not provided any details of the error or your data source. Assuming you're using SharePoint, I think the below is what you're trying to do.

     

    Note that the Search function is not delegable. If this does not matter to you and you can be certain that your data volumes will be under 2000 rows, then I would eliminate the use of the StartsWith function and instead use Search for the "Your Name" and "Mitigation" owner People columns as well.

     

    SortByColumns(
     Search(
     Filter(
     RiskIssueTrackerV2,
     Len(txtNameFilter.Text) = 0 || StartsWith(
     'Your name'.DisplayName,
     txtNameFilter.Text
     ),
     Len(txtMitigationOwner.Text) = 0 || StartsWith(
     'Mitigation Owner'..DisplayName,
     txtMitigationOwner.Text
     ),
     Len(ImpactType.Selected.Value) = 0 || 'Primary Impact type'.Value = ImpactType.Selected.Value,
     Len(RiskorIssue.Selected.Value) = 0 || 'Risk or Issue'.Value = RiskorIssue.Selected.Value,
     Len(DataRiskCat.Selected.Value) = 0 || 'Risk or Issue Category'.Value = DataRiskCat.Selected.Value
     ),
     TxtTitle.Text,
     "Title"
     ),
     "ID",
     If(
     varSortDirection = SortOrder.Ascending,
     SortOrder.Descending,
     SortOrder.Ascending
     )
    )

     

  • WarrenBelz Profile Picture
    156,774 Most Valuable Professional on at

    @PrashantParekh ,

    Just adding something that may assist with your Delegation issue - this will work if the main filter output is under your Data Row Limit. Also set the Default of your two StartsWith text boxes to "" (empty string)

    With(
     {
     _Data:
     SortByColumns(
     Filter(
     RiskIssueTrackerV2,
     (
     StartsWith(
     'Your name'.DisplayName,
     txtNameFilter.Text
     ) ||
     StartsWith(
     'Mitigation Owner'.DisplayName,
     txtMitigationOwner.Text
     )
     ) && 
     (
     'Primary Impact type'.Value = ImpactType.Selected.Value || 
     Len(ImpactType.Selected.Value) = 0
     ) &&
     (
     'Risk or Issue'.Value = RiskorIssue.Selected.Value || 
     Len(RiskorIssue.Selected.Value) = 0
     ) &&
     (
     'Risk or Issue Category'.Value = DataRiskCat.Selected.Value || 
     Len(DataRiskCat.Selected.Value = 0
     )
     ),
     "ID",
     If(
     varSortDirection = SortOrder.Ascending,
     SortOrder.Descending,
     SortOrder.Ascending
     )
     )
     },
     Search(
     _Data,
     TxtTitle.Text,
     "Title (Risk or Issue)"
     )
    )
  • PritishT Profile Picture
    47 on at

    @WarrenBelz Hello Sir, Am I safe to assume the following

    1. Initial sharepoint List has more than 2000 rows however

    2. With the applied filters, the data row displayed is now less than 2000

    3. Because of this, the above code mentioned will work with the Search() function

     

    Many thanks again

  • WarrenBelz Profile Picture
    156,774 Most Valuable Professional on at

    @PritishT ,

    All of 1-3 are correct

  • PritishT Profile Picture
    47 on at

    @WarrenBelz  I'll give it a try. thank you very much for the quick response.

    P.S- do you have a youtube channel where you share these useful tips&tricks

  • WarrenBelz Profile Picture
    156,774 Most Valuable Professional on at

    @PritishT ,

    I have a website that may be useful

  • PrashantParekh Profile Picture
    47 on at

    Thank you everyone for your support.

    @Amik @WarrenBelz I tried both the codes but I had quite a few errors, so I've had to amend slightly. I will work on this.

     

    Currently I have got approx 50 items to search from.  

     

    I've managed to add the "search" and txttitle.text, "text"

     

    The only error I have now is "Delegation" warning. Working on how to fix this now. If there is a way to resolve this please drop a message. Thank you

     

     

     

    SortByColumns(
        Search(
                Filter(
                    RiskIssueTrackerV2,
            StartsWith(
                'Your name'.DisplayName,
                txtNameFilter.Text
            ),
            StartsWith(
                'Mitigation Owner'.DisplayName,
                txtMitigationOwner.Text
            )
            && ('Primary Impact type'.Value = ImpactType.Selected.Value || ImpactType.Selected.Value = Blank())
            && ('Risk or Issue'.Value = RiskorIssue.Selected.Value || RiskorIssue.Selected.Value = Blank())
            && ('Risk or Issue Category'.Value = DataRiskCat.Selected.Value || DataRiskCat.Selected.Value = Blank())
           
        ),
        TxtTitle.Text,
        "Title"
    ),
        "ID",
        If(
            varSortDirection = SortOrder.Ascending,
            SortOrder.Descending,
            SortOrder.Ascending
        )
    )
  • WarrenBelz Profile Picture
    156,774 Most Valuable Professional on at

    Hi @PrashantParekh ,

    As below with a couple of other suggestions - this is basically what I posted earlier. The whole point of the With() statement is to manage Delegation issues.

    With(
     {
     _Data:
     SortByColumns(
     Filter(
     RiskIssueTrackerV2,
     StartsWith(
     'Your name'.DisplayName,
     txtNameFilter.Text
     ) &&
     StartsWith(
     'Mitigation Owner'.DisplayName,
     txtMitigationOwner.Text
     ) && 
     (
     'Primary Impact type'.Value = ImpactType.Selected.Value || 
     Len(ImpactType.Selected.Value) = 0
     ) && 
     (
     'Risk or Issue'.Value = RiskorIssue.Selected.Value || 
     Len(RiskorIssue.Selected.Value) = 0
     ) && 
     ( 
     'Risk or Issue Category'.Value = DataRiskCat.Selected.Value || 
     Len(DataRiskCat.Selected.Value) = 0
     )
     ),
     "ID",
     If(
     varSortDirection = SortOrder.Ascending,
     SortOrder.Descending,
     SortOrder.Ascending
     )
     )
     },
     Search(
     _Data,
     TxtTitle.Text,
     "Title"
     )
    )

    I am not sure whether you need And() or Or() on your StartsWith set.

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

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 345 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 225

#3
M Bilal Khan Profile Picture

M Bilal Khan 192

Last 30 days Overall leaderboard