cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Filter and Sorting Question

All,

 

I am new to Powerapps. Have been working on this specific issue for more than 2 days. Any pointer or help is appreciated. 

 

Scenario:

1) Need to Filter a Gallery to show only items from today.  have been able to do this by placing the following code on the Item property of the gallery. 

SortByColumns(Filter(TaskList, Text(Created, DateTimeFormat.LongDate) = Text(Today(), DateTimeFormat.LongDate)), "ParentID", Descending)

 2) Need to have a single chechbox to further filter the code above to limit the rows returned and filterout those that have no values in a specific column (ticket_number). So if ticket_number is blank then don't show it when checkbox is selected.

 

I am not sure where to put this and how to integrate it with the above code that it does not mess it up. Any idea/pointer as how to do this?

 

Thanks in advance,

Gulf_Man

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Resolver II
Resolver II

Re: Filter and Sorting Question

Hi, you can use the Switch function. Set a variable when the checkbox = true or false and use that in the Switch statement to filter two different statements.
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-if

In this example I use the variable called filterBy and it's value can be 1 or 2
In your checkbox you could do something like this, onCheck = UpdateContext ({filterBy:1})

onUnCheck = UpdateContext ({filterBy:2})

 

example filter, modify to your requirments
Switch(filterBy,1, SortByColumns(Filter(appDailyJobSheets_1, Employee = Dropdown2_1.Selected.Value && Status = "New"),"Start_x0020_Time"),2,SortByColumns(Filter(appDailyJobSheets_1, ContractNo = cboDropContractNo2_1.Selected.Contract && Status = "New"),"Start_x0020_Time"))

View solution in original post

Highlighted
Anonymous
Not applicable

Re: Filter and Sorting Question

Thank You Andy. Had to tweek it a bit but I seems to be working.

View solution in original post

2 REPLIES 2
Highlighted
Resolver II
Resolver II

Re: Filter and Sorting Question

Hi, you can use the Switch function. Set a variable when the checkbox = true or false and use that in the Switch statement to filter two different statements.
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-if

In this example I use the variable called filterBy and it's value can be 1 or 2
In your checkbox you could do something like this, onCheck = UpdateContext ({filterBy:1})

onUnCheck = UpdateContext ({filterBy:2})

 

example filter, modify to your requirments
Switch(filterBy,1, SortByColumns(Filter(appDailyJobSheets_1, Employee = Dropdown2_1.Selected.Value && Status = "New"),"Start_x0020_Time"),2,SortByColumns(Filter(appDailyJobSheets_1, ContractNo = cboDropContractNo2_1.Selected.Contract && Status = "New"),"Start_x0020_Time"))

View solution in original post

Highlighted
Anonymous
Not applicable

Re: Filter and Sorting Question

Thank You Andy. Had to tweek it a bit but I seems to be working.

View solution in original post

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

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 (8,071)