cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Prodigy
Post Prodigy

Gallery Filtering Not Working

Hi Folks -

 

I have the following formula for my gallery:

SortByColumns(
	AddColumns(
		Filter(rdAssets, 
			StartsWith(Alias, TextSearchBox4.Text) || 
			StartsWith(Name, TextSearchBox4.Text) ||
			StartsWith(Target_x0020_Short_x0020_Name, TextSearchBox4.Text) ||
			StartsWith(Brand_x0020_Name, TextSearchBox4.Text) ||
			StartsWith(PF_Research_Code, TextSearchBox4.Text) ||
			StartsWith(Generic_x0020_Name, TextSearchBox4.Text) ||
			StartsWith(Development_Name, TextSearchBox4.Text) ||
			StartsWith(Alternate_Name, TextSearchBox4.Text) && !(Portfolio_x0020_Status.Value="Terminated")), 
	"txtPortfolioStatus", Portfolio_x0020_Status.Value),
	"txtPortfolioStatus", If(SortDescending1, Descending, Ascending),
"Alias", If(SortDescending1, Descending, Ascending)
)

The issue is that I'm still able to see "Terminated" values and I'm not sure why. 

 

 

For instance:

 

PFC.jpg

 

Gallery Search:

pfc visible.jpg

Based on my formula, would there be any reason why this is?  The field "GovernanceStatus" is a Choice field, if that makes a difference?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User
Dual Super User

Re: Gallery Filtering Not Working

@simms7400 

 

The code is not working properly, maybe because you added the closing bracket at the wrong place, it is considering Status condition inside the Or clause. Please use the following expression and this should resolve your issue:
SortByColumns(
    Filter(rdInvestments, CompoundCode = AssetBrowseGallery.Selected.Name,
        Or(
        StartsWith(ProjectAlias, TextSearchBox5.Text),
        StartsWith(ProjectCode, TextSearchBox5.Text),
        StartsWith(IND_DESC, TextSearchBox5.Text),
        StartsWith(IND_CODE, TextSearchBox5.Text)), !(PortfolioStatus.Value="Terminated")),
"ProjectAlias", If(SortDescending1, Descending, Ascending)
)
Hope this Helps!

View solution in original post

10 REPLIES 10
Highlighted
Dual Super User
Dual Super User

Re: Gallery Filtering Not Working

Hi @simms7400 

 

Please refer to: 

 

SortByColumns(
    AddColumns(
        Filter(rdAssets, Or(StartsWith(Alias, TextSearchBox4.Text),StartsWith(Name, TextSearchBox4.Text),StartsWith(Target_x0020_Short_x0020_Name, TextSearchBox4.Text),StartsWith(Brand_x0020_Name, TextSearchBox4.Text),StartsWith(PF_Research_Code, TextSearchBox4.Text),StartsWith(Generic_x0020_Name, TextSearchBox4.Text),StartsWith(Development_Name, TextSearchBox4.Text),StartsWith(Alternate_Name, TextSearchBox4.Text)) && !(Portfolio_x0020_Status.Value="Terminated")),
    "txtPortfolioStatus", Portfolio_x0020_Status.Value),
    "txtPortfolioStatus", If(SortDescending1, Descending, Ascending),
"Alias", If(SortDescending1, Descending, Ascending)
)
 
This is because whenever one of your || condition satisfies, it shows the data and ignores all the other condition. 
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Highlighted
Community Support
Community Support

Re: Gallery Filtering Not Working

Hi @simms7400 ,

Please try this formula:

SortByColumns(
	AddColumns(
		Filter(rdAssets, 
			StartsWith(Alias, TextSearchBox4.Text) || 
			StartsWith(Name, TextSearchBox4.Text) ||
			StartsWith(Target_x0020_Short_x0020_Name, TextSearchBox4.Text) ||
			StartsWith(Brand_x0020_Name, TextSearchBox4.Text) ||
			StartsWith(PF_Research_Code, TextSearchBox4.Text) ||
			StartsWith(Generic_x0020_Name, TextSearchBox4.Text) ||
			StartsWith(Development_Name, TextSearchBox4.Text) ||
			StartsWith(Alternate_Name, TextSearchBox4.Text) ,
!(Portfolio_x0020_Status.Value="Terminated")
), "txtPortfolioStatus", Portfolio_x0020_Status.Value
),
"txtPortfolioStatus", If(SortDescending1, SortOrder.Descending, SortOrder.Ascending), "Alias", If(SortDescending1, SortOrder.Descending, SortOrder.Ascending) )

 Filter(table,formula1,formula2) 

formula1 and formula2 is combined with "And".

Here's doc for your reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-filter-lookup

 

 

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Post Prodigy
Post Prodigy

Re: Gallery Filtering Not Working

@v-yutliu-msft 

 

That worked perfectly, thank you so much! I now went through an updated all my galleries with tha logic!

One thing I'm noticing with one particular gallery is that when I add the "Portfolio Status" condition (to exclude), it does not show some data elements even though they are NOT "Terminated".

 

Here is the formula that works and displays all data elements:

SortByColumns(
	Filter(rdInvestments, CompoundCode = AssetBrowseGallery.Selected.Name,
		Or(
		StartsWith(ProjectAlias, TextSearchBox5.Text),
		StartsWith(ProjectCode, TextSearchBox5.Text),
		StartsWith(IND_DESC, TextSearchBox5.Text),
		StartsWith(IND_CODE, TextSearchBox5.Text))),
"ProjectAlias", If(SortDescending1, Descending, Ascending)
)

But when I add the exclusion condition, it doesn't display correctly and its excluding data elements even WITH a Portfolio Status of "Active".

 

SortByColumns(
	Filter(rdInvestments, CompoundCode = AssetBrowseGallery.Selected.Name,
		Or(
		StartsWith(ProjectAlias, TextSearchBox5.Text),
		StartsWith(ProjectCode, TextSearchBox5.Text),
		StartsWith(IND_DESC, TextSearchBox5.Text),
		StartsWith(IND_CODE, TextSearchBox5.Text)) && !(PortfolioStatus.Value="Terminated")),
"ProjectAlias", If(SortDescending1, Descending, Ascending)
)

What could be the issue?

 

Thanks!

Highlighted
Community Support
Community Support

Re: Gallery Filtering Not Working

Hi @simms7400 ,

I notice that the choice name is "GovernanceStatus" in Access table.

Could you tell me why you use "PortfolioStatus" in formula?

Try this:

SortByColumns(
	AddColumns(
		Filter(rdAssets, 
			StartsWith(Alias, TextSearchBox4.Text) || 
			StartsWith(Name, TextSearchBox4.Text) ||
			StartsWith(Target_x0020_Short_x0020_Name, TextSearchBox4.Text) ||
			StartsWith(Brand_x0020_Name, TextSearchBox4.Text) ||
			StartsWith(PF_Research_Code, TextSearchBox4.Text) ||
			StartsWith(Generic_x0020_Name, TextSearchBox4.Text) ||
			StartsWith(Development_Name, TextSearchBox4.Text) ||
			StartsWith(Alternate_Name, TextSearchBox4.Text) ,
!(GovernanceStatus.Value="Terminated")
), "txtPortfolioStatus", GovernanceStatus.Value
),
"txtPortfolioStatus", If(SortDescending1, SortOrder.Descending, SortOrder.Ascending), "Alias", If(SortDescending1, SortOrder.Descending, SortOrder.Ascending) )

 

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Post Prodigy
Post Prodigy

Re: Gallery Filtering Not Working

@v-yutliu-msft  Thanks for your reply.

 

What happened was in SharePoint, I renamed to "GovernanceStatus" from "PortoflioStatus". Therefore, POwerApps only recognizes the old name unless I completely delete the SP Column and re-add.

 

See screen shot below:

GOV.jpg

Highlighted
Post Prodigy
Post Prodigy

Re: Gallery Filtering Not Working

I have solved this, it was a syntax error on my part.

 

Thank you!

Highlighted
Post Prodigy
Post Prodigy

Re: Gallery Filtering Not Working

Nevermind, I was mistaken.  Same issue.

Highlighted
Post Prodigy
Post Prodigy

Re: Gallery Filtering Not Working

This is my formula and for some reason, it's still including data elements that have a value of "Terminated" for "PortfolioStatus"

 

SortByColumns(
	Filter(rdInvestments, CompoundCode = AssetBrowseGallery.Selected.Name,
		Or(
		StartsWith(ProjectAlias, TextSearchBox5.Text),
		StartsWith(ProjectCode, TextSearchBox5.Text),
		StartsWith(IND_DESC, TextSearchBox5.Text),
		StartsWith(IND_CODE, TextSearchBox5.Text), !(PortfolioStatus.Value="Terminated"))),
"ProjectAlias", If(SortDescending1, Descending, Ascending)
)
Highlighted
Dual Super User
Dual Super User

Re: Gallery Filtering Not Working

@simms7400 

 

The code is not working properly, maybe because you added the closing bracket at the wrong place, it is considering Status condition inside the Or clause. Please use the following expression and this should resolve your issue:
SortByColumns(
    Filter(rdInvestments, CompoundCode = AssetBrowseGallery.Selected.Name,
        Or(
        StartsWith(ProjectAlias, TextSearchBox5.Text),
        StartsWith(ProjectCode, TextSearchBox5.Text),
        StartsWith(IND_DESC, TextSearchBox5.Text),
        StartsWith(IND_CODE, TextSearchBox5.Text)), !(PortfolioStatus.Value="Terminated")),
"ProjectAlias", If(SortDescending1, Descending, Ascending)
)
Hope this Helps!

View solution in original post

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,876)