cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Advocate II
Advocate II

Search and Sort issues

Greetings, 

 

I am new to PowerApps. I have major issues with the sort and search buttons that are given to me when creating a PowerApp from a data source.

 

I am connected to a SharePoint list. I'd like for the sort button (figure 1) to sort the data by ID (integer). The default appears to be:

sort_button.PNG                                                                                              Figure 1

Function: 

 

OnSelect = UpdateContext({SortDescending1: !SortDescending1})

 

Expected Result of function: Sort Alphabetically

Actual Result: Nothing Happens.

Tried Solutions: I have pressed that up and down arrow button and clicked the refresh button next to it. Nothing happened. I have been through to documentation and tried to use examples from there. They have also not worked. 

Error listed: none

 

------------------------------------------------------------------------------------------------------------------------------------------

 

Problem: I attempted to rewrite the sorting function to sort numerically. 

Function:

 

OnSelect = UpdateContext({SortDescending1: !SortDescending1, SetPriority: "ID"})

 

Expected Result: Sort Numerically

Actual Result: Nothing Happens 

Tried Solutions: Again I have been through to documentation trying to get such functionality to work. 

Error listed: none

 

--------------------------------------------------------------------------------------------------------------------------------------

 

Problem: The search button does not work. There was no starting functionality added by default on startup. search_button.PNG

                                                                                                  Figure 2 

Desired Result: Ideally a user could search for several popular columns in the SharePoint list (Title, ID, Category, Department, Priority). The search button would filter for that text.

Tried Solutions: I have referenced the documentation and do not understand what I could be doing wrong. I have tried to write several functions for the result I'd like. I tried to keep it simple until I understand more. For example, I want to only search for a particular item ID. 

 

Function: 

 

OnSelect = Search( ECTCR_Tracking, SearchInput.Text, "ID" )

 

Note: The text input the search button "should" be referencing is named SearchInput. 

 

Error listed: "Suggestion: Part of this Search formula cannot be evaluated remotely due to service limitations. The local evaluation may produce suboptimal or partial results. If possible, please simplify the formula. For more information, please see the search function documentation. "

 

Please help. I don't understand what is going on. 

 

23 REPLIES 23

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

Well, that seemed to work. Thanks.

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

Advocate II
Advocate II

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
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Top Solution Authors
Top Kudoed Authors
Users online (38,119)