cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
DReimer
Level: Powered On

Filtering initial values in Gallery

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?

1 ACCEPTED SOLUTION

Accepted Solutions
mr-dang
Level 10

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. 

Microsoft Employee
@8bitclassroom

View solution in original post

4 REPLIES 4
Marek
Level: Powered On

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

 

DReimer
Level: Powered On

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.

mr-dang
Level 10

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. 

Microsoft Employee
@8bitclassroom

View solution in original post

iOkidoki
Level: Power Up

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.

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 81 members 3,424 guests
Please welcome our newest community members: