cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KarlBurg
Level: Power Up

Trying to filter based on Status of specific Item

Hi i'm trying to Filter Items with the specific status when they press a Button.

 

So if they press the Button 'New' only the Items with the Status 'New' should show up, the same should happen with the other three Buttons.

 

I'm using a Globalvariable for this which is called "ExpensesStatus".

I just don't understand how to filter it.

 

Current Gallery Items

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

Current Button

Set(ExpensesStatus,"New")

Globalvariable

Set(ExpensesStatus,"New");
Set(ExpenseSorting,Descending);

ClearCollect(NewReports,Filter(Expenses,Status.Value = "New").ID);
ClearCollect(ApprovedReports,Filter(Expenses,Status.Value = "Approved").ID);
ClearCollect(ExportedReports,Filter(Expenses,Status.Value = "Exported").ID); ClearCollect(DeclinedReports,Filter(Expenses,Status.Value = "Declined").ID);
Refresh(Expenses)

Thanks

1 REPLY 1
Community Support Team
Community Support Team

Re: Trying to filter based on Status of specific Item

HI @KarlBurg ,

Could you please share a bit more about your scenario?

Do you want to filter your Gallery items based on which button do you press? And display all records within your Galley in default?

 

Based on the needs that you mentioned, I have made a test on my side, please take a try with the following workaround:

Set the OnSelect property of the "New" button to following:

Set(ExpensesStatus,"New")

Set the OnSelect property of the "Exported" button to following:

Set(ExpensesStatus,"Exported")

Set the OnSelect property of the "Approved" button to following:

Set(ExpensesStatus,"Approved")

...

Set the Items property of the Gallery to following:

If(
   IsBlank(ExpensesStatus),
   SortByColumns(
Filter(Expenses, StartsWith(Title, TextSearchBox1.Text)),
"Title",
If(SortDescending1, Descending, Ascending)
), SortByColumns(
Filter(
Expenses,
StartsWith(Title, TextSearchBox1.Text),
Status.Value = ExpensesStatus
),
"Title",
If(SortDescending1, Descending, Ascending)
) )

More details about Filter function in PowerApps, please check the following article:

Filter function

 

In addition, if you want to remove the Status filter condition from your Gallery, you could consider take a try to add the following formula within the OnSelect property of the "Refresh" icon button to following:

Set(ExpensesStatus, Blank())

when you click "Refresh" icon button, all available records would show up within your Gallery again.

 

Best regards,

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

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 207 members 5,388 guests
Please welcome our newest community members: