cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
AndySid
Level 8

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

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
AndySid
Level 8

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

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
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 (Last 30 Days)
Users online (5,906)