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 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 Microsoft Employee

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,145 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
    Microsoft Employee 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

    PowerAppsCommunity_Reza-Dorrani_2019-08-27_11-41-19.png
  • RezaDorrani Profile Picture
    12,145 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
    Microsoft Employee 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
    Microsoft Employee 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
    Microsoft Employee 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)
    )

    PowerAppsCommunity_v-xida-msft_2019-08-29_9-33-31.png
    PowerAppsCommunity_v-xida-msft_2019-08-29_10-00-21.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

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 505

#2
WarrenBelz Profile Picture

WarrenBelz 502 Most Valuable Professional

#3
Haque Profile Picture

Haque 324

Last 30 days Overall leaderboard