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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Search on multiple fie...
Power Apps
Unanswered

Search on multiple fields: Nesting with Sort and Filter in Gallery.Items formula

(0) ShareShare
ReportReport
Posted on by

I have the below listed formula on Gallery.Items.  I want to search on basically all of the columns, not only "Activity_Name".  Examples include "Description" (a multi-line text field), "Technology_Areas" (a combo box), and "Industry" (a drop-down choice).  Any thoughts on how to integrate that capability into my code?

 

Thanks in advance!

 

-Jake

 

SortByColumns(
Filter(
If(varMyItems, Filter('Engagement Form', 'Created By'.DisplayName = gvCurrentUserName), 'Engagement Form'),
StartsWith(Activity_Name, TextSearchBox1.Text)
),
"ID",
If(SortDescending1, Descending, Ascending)
)

 

Categories:
I have the same question (0)
  • RezaDorrani Profile Picture
    12,143 on at

    Hi @Anonymous 

     

    you will have to add AND(&&) and OR (||) logic to your query

     

    Example:

     

    SortByColumns(
    Filter(
    If(varMyItems, Filter('Engagement Form', 'Created By'.DisplayName = gvCurrentUserName && StartsWith(Description && Industry.Value = IndustryDropdown.Selected.Value,descriptionTextBox.Text)), 'Engagement Form'),
    StartsWith(Activity_Name, TextSearchBox1.Text)
    ),
    "ID",
    If(SortDescending1, Descending, Ascending)
    )

     

    Regards,

    Reza Dorrani

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

  • Community Power Platform Member Profile Picture
    on at

    Hi Reza,

     

    This did not work.  I have attached a screenshot taken after I cleaned up the column names.  Also, the StartsWith function is included twice?

     

    -Jake

  • RezaDorrani Profile Picture
    12,143 on at

    Hi @Anonymous 

     

    Sorry was on a poor wifi network which did not paste the correct format

     

    This is your original function

     

    SortByColumns(
    Filter(
    If(varMyItems, Filter('Engagement Form', 'Created By'.DisplayName = gvCurrentUserName && Code), 'Engagement Form'),
    StartsWith(Activity_Name, TextSearchBox1.Text)
    ),
    "ID",
    If(SortDescending1, Descending, Ascending)
    )

     

    Just add (below is just an example) to your existing logic

    Code = 

    StartsWith(Description,descriptionsearchbox.Text ) && Industry.Value = IndustryDropdown.Selected.Value

     

    Assuming Industry is a column of type Choice

     

    Regards,

    Reza Dorrani

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

  • v-xida-msft Profile Picture
    on at

    Hi @Anonymous ,

    Could you please share a bit more about the "Technology_Areas" field and  "Industry" field in your SP List data source? Are they Choice type column?

    Durther, do you want the TextSearchBox1 search text to be also searched within "Description" field, "Technology_Areas" field and "Industry" field?

     

    Currently, within PowerApps, the StartsWith function could only be used to test whether one Text type column begins with a text value, it could not be used for Complex type column, e.g. Choice, LookUp, Person column type in SP list.

     

    As an alternative solution, please take a try with the following workaround:

    Please consider modify your formula as below:

    SortByColumns(
     Filter(
     AddColumns('Engagement Form', "IndustryValue", Industry.Value, "Technology_AreasValue", Technology_Areas.Value),
    If(varMyItems, 'Created By'.DisplayName = gvCurrentUserName, true), StartsWith(Activity_Name, TextSearchBox1.Text) || StartsWith(Description, TextSearchBox1.Text) || StartsWith(IndustryValue, TextSearchBox1.Text) || StartsWith(Technology_AreasValue, TextSearchBox1.Text) ), "ID", If(SortDescending1, Descending, Ascending) )

    Note: Please set the "Data row limits for Non-delegable queries" option to maximum value -- 2000 within Advanced settings of App settings of your app. I assume that the "Technology_Areas" field and  "Industry" field are both Choice type column in your 'Engagement Form' data source.

     

    Please take a try with above solution, check if the issue is solved.

     

    Best regards,

  • Community Power Platform Member Profile Picture
    on at

    Hi Reza,

    I wasn't able to make this work for some reason.  Any way you can integrate the code for me?

    -Jake

  • Community Power Platform Member Profile Picture
    on at

    Hi Kris,

     

    Technology_Areas is a combo box and Industry is a drop-down choice.  Yes I would love it if I could search all of the fields.  I removed the Technology_Areas argument from the StartsWith function in your code (listed below), and while the search appears to be working properly for Description and Industry, after selecting the list item from the gallery, the details never load.  Please refer to the screenshots below.  And thank you in advance!

     

    -Jake

     

    SortByColumns(
    Filter(
    AddColumns('Engagement Form', "IndustryValue", Industry.Value, "Technology_AreasValue", Technology_Areas.Value),
    If(varMyItems, 'Created By'.DisplayName = gvCurrentUserName, true),
    StartsWith(Activity_Name, TextSearchBox1.Text) || StartsWith(Description, TextSearchBox1.Text) || StartsWith(IndustryValue, TextSearchBox1.Text)
    ),
    "ID",
    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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard