cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Microsoft Michael
Microsoft

Re: Search and Sort issues

Also, I realized you may run into issues since you have two separate buttons for Approved/Pending. If you are modeling this interaction based on the sort order, the primary difference is that sorting has two states, ascending and descending. So, the button simply toggles between these two. However, your approved/pending filtering actually has three states that are related to each other. no filtering, approved only, pending only.

In order to properly handle this, it won't be sufficient to use the same interaction as the Sort button. Instead, you may want to have a dropdown that chooses between one of the three states. You can then change the Filter based on this dropdown's value with the Switch() function.

 

This could look like

Filter(
    ECTCR_Tracking,
    Switch(
	ApprovalStatus.Selected.Value,
	"Approved Only", CP_x0020_Status.Value = "Approved",
	"Pending Only", CP_x0020_Status.Value = "Pending",
	"Any", true
    )
)

 

When this is nested into the entire function, it would look like the following:

 

 

SortByColumns(
    Filter(
        Filter(
            ECTCR_Tracking,
            Switch(
                ApprovalStatus.Selected.Value,
                "Approved Only", CP_x0020_Status.Value = "Approved",
                "Pending Only", CP_x0020_Status.Value = "Pending",
                "Any", true
            )
        ),
        StartsWith(Title, SearchInput.Text) || 
        StartsWith(Text(ID, "[$-en-US]##"), SearchInput.Text)
    ), 
    "ID", 
    If(
        SortDescending1, 
        Descending, 
        Ascending
    )
)

 

View solution in original post

Johnathon_S
Level: Powered On

Re: Search and Sort issues

Well, that seemed to work. Thanks.

Microsoft Michael
Microsoft

Re: Search and Sort issues

Glad that it worked out for you! Feel free to ask any questions if there are parts of that you don't understand.

Johnathon_S
Level: Powered On

Re: Search and Sort issues

I know JavaScript and other languages pretty well. It’s just a matter of getting used to the PowerApps syntax I think. After that change my flows stopped working correctly, though. I made a different post about it.

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps 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

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,004)