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

Filtering Gallery

I am trying to filter a gallery so that when a user logs into the app it shows records as below:

 

1. Rcords created by the "signed in" user only (this works)

2. Sorts the records in date/time order

 

How can I amend the code below that currently works for point 1 above, but then also makes point 2 possible? The date column I am using is called "Created". 

 

Any help greatly appreciated.

 

If(IsBlank(TextSearchBox1.Text),(Filter(DWB_Test,User().Email in Person.Email))

 

Powerapps.JPG

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Filtering Gallery

Hi @skidmarks64,

 

First of all, I'd like to point out that the first formula you are using is quite unusual.

If(IsBlank(TextSearchBox1.Text),(Filter(DWB_Test,User().Email in Person.Email))

 

I think you are using the If function like If( ConditionThenResult [, DefaultResult ] ). Since you didn't identify the DefaultResult , when you fill anything in the TextSearchBox1, then the gallery will show as blank.

 

I assume that you first want to filter the gallery created by the "signed in" user first. Then you also want to filter according to Title(for example) filled in TextSearchBox1. Then the formula should be:

If(IsBlank(TextSearchBox1.Text),Filter('List Test',Person.Email=User().Email),Filter(Filter('List Test',Person.Email=User().Email),TextSearchBox1.Text in Text(Title)))

 

Then, if you also want to sort by date and time column, you just need a similar formula like below:

SortByColumns(If(IsBlank(TextSearchBox1.Text),Filter('List Test',Person.Email=User().Email),Filter(Filter('List Test',Person.Email=User().Email),TextSearchBox1.Text in Text(Title))),"Created",SortOrder.Descending)

I tested with above formula and it works like a charm.

List Test -> My list name

Person -> a Person column name

Title -> Default first column in SP list, which is text column type

 

Capture.PNG

 

Regards,

Mona

 

 

 

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
6 REPLIES 6
skidmarks64
Level: Powered On

Re: Filtering Gallery

OK I have made some progress. The following forumla's both work in seperation and perform tasks 1 and 2 above seperatley.

 

If(IsBlank(TextSearchBox1.Text),Filter(DWB_Test,User().Email in Person.Email),

 

SortByColumns(DWB_Test,"Created",SortOrder.Descending)

 

Any idea how I might combine them to complete both tasks 1 and 2?

DanielaH
Level 8

Re: Filtering Gallery

Perhaps try this?

 

SortByColumns(If(IsBlank(TextSearchBox1.Text),Filter(DWB_Test,User().Email in Person.Email),"Created",SortOrder.Descending))

skidmarks64
Level: Powered On

Re: Filtering Gallery

Daniel,

 

Thanks for the input but your suggestion above does not work.

Community Support Team
Community Support Team

Re: Filtering Gallery

Hi @skidmarks64,

 

First of all, I'd like to point out that the first formula you are using is quite unusual.

If(IsBlank(TextSearchBox1.Text),(Filter(DWB_Test,User().Email in Person.Email))

 

I think you are using the If function like If( ConditionThenResult [, DefaultResult ] ). Since you didn't identify the DefaultResult , when you fill anything in the TextSearchBox1, then the gallery will show as blank.

 

I assume that you first want to filter the gallery created by the "signed in" user first. Then you also want to filter according to Title(for example) filled in TextSearchBox1. Then the formula should be:

If(IsBlank(TextSearchBox1.Text),Filter('List Test',Person.Email=User().Email),Filter(Filter('List Test',Person.Email=User().Email),TextSearchBox1.Text in Text(Title)))

 

Then, if you also want to sort by date and time column, you just need a similar formula like below:

SortByColumns(If(IsBlank(TextSearchBox1.Text),Filter('List Test',Person.Email=User().Email),Filter(Filter('List Test',Person.Email=User().Email),TextSearchBox1.Text in Text(Title))),"Created",SortOrder.Descending)

I tested with above formula and it works like a charm.

List Test -> My list name

Person -> a Person column name

Title -> Default first column in SP list, which is text column type

 

Capture.PNG

 

Regards,

Mona

 

 

 

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
skidmarks64
Level: Powered On

Re: Filtering Gallery

Mona,

 

Many, many  thanks this does indeed work for me to.

 

However there is a little warning that basically states, "the local evaluation might produce partial results...please try and simplify the formula".

 

Not sure if this is somehting I should worry about?

Community Support Team
Community Support Team

Re: Filtering Gallery

Hi @skidmarks64,

 

The blue dot suggestions appear when a formula contains something that cannot be delegated. This makes it easier to know what is and is not being delegated. 

https://docs.microsoft.com/en-us/powerapps/delegation-overview#blue-dot-suggestions

 

Formulas that cannot be delegated will be processed locally. This allows for the full breadth of the PowerApps formula language to be used. But at a price: all the data must be brought to the device first, which could involve retrieving a large amount of data over the network. That can take time, giving the impression that your app is slow or possibly hung. To avoid this, PowerApps imposes a limit on the amount of data that can be processed locally: 500 records. 

 

So when you have more than 500 records in this gallery, it will only show 500 of them in this app. 

 

Regards,

Mona

 

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.