Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Filtering initial values in Gallery

(0) ShareShare
ReportReport
Posted on by

I'm trying to display items in a gallery, but filter by a column that is text. Example below:

 

Item Number

Item Title

Item Description

Item Health

 

I want to ONLY show the items with Item Health = to "1 Red" or "2 Yellow" or "3 Green"....

 

This is for a sort of "dashboard" app. The data source is a list view. I can see all the values, I just can't get the initial filter to work right. Ideas?

  • iOkidoki Profile Picture
    iOkidoki 2 on at
    Re: Filtering initial values in Gallery

    Hi,

     

    Thanks for taking the time to help.

    Please I am using similar code but I am having problem searching on the mobile or when using the link to test.

    This is my code:

    SortByColumns(Filter('PowerApps BOW',StartsWith(Title,TextSearchBox1.Text)),"Title", If(SortDescending1, Descending, Ascending))

     

    When I test the search from the https://create.powerapps.com/studio/#

    The search works fine, but no so when I test is with mobile or using the link, also other users can not search from their devices.

    Please can you help?

     

    Thank you.

  • Verified answer
    Brian Dang Profile Picture
    Brian Dang 3,976 on at
    Re: Filtering initial values in Gallery

    Current:

    SortByColumns(
     Filter(MyList, 
     StartsWith(Title, TextSearchBox1.Text)
     ), 
     "Title", If(SortDescending1, Descending, Ascending)
    )

    If you want to add more conditions, you would place it in this red spot:

    SortByColumns(
     Filter(MyList, 
     StartsWith(Title, TextSearchBox1.Text) &&
     column=value
     ), 
     "Title", If(SortDescending1, Descending, Ascending)
    )

    You could use && to mean "and" or you can use a comma in the Filter formula:

     

    SortByColumns(
     Filter(MyList, 
     StartsWith(Title, TextSearchBox1.Text),
     column=value
     ), 
     "Title", If(SortDescending1, Descending, Ascending)
    )

     

    Repeat that for as many conditions as you want.

     

    Let me know how it goes. 

  • Re: Filtering initial values in Gallery

    I tried this and cannot get it to work either way. I have tried just about everything to get this to sort by the correct column, and cannot get it to work. It will only sort by the default formula:

     

    SortByColumns(Filter(MyList, StartsWith(Title, TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending))

     

    Where in the above statement would I put more filter criteria? This statement provides the entire list, and you can search by "Title" in a search bar at the top. I get all that....what I do NOT get, is how to add in more filter criteria.

  • Marek Profile Picture
    Marek 43 on at
    Re: Filtering initial values in Gallery

    Hi

     

    I am sorry im not very good at understanding things, but

     

    If you select Gallery on the left (1), then choose property Items (2) there is a value (3).

    Its is like "NameOfDataSource" (For my case it is SharePoint Online list called "PosunutyCas1")

    If I set only "PosunutyCas1 it get all items by default".

     

    With Filter function I try to filter this list to only items which column ID=1 or ID=1 (sorry but its nonsense the same value)

    But in your case maybe Filter(MyList1;Health="1 Red" || Health="2 Yellow" || "3 Green")

     

    (I have not english language, so formula separators etc syntax may be different, in english documentation and example:

    https://powerapps.microsoft.com/en-us/tutorials/function-filter-lookup/

     

    But i will try first like Filter(MyList1,Health="1 Red")

     

    filter.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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,495

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,822

Leaderboard