cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
New Member

Can't sort by Choice Value with SortByColumns

So I have tried:

 

SortByColumns(Filter([@MyList], StartsWith(Approve.Value, TextSearchBox1.Text)), "Approve", If(SortDescending1, Descending, Ascending))

 

But I cannot sort on the "Approve" value.

 

The above works if I change "Approve" to "ID" or "Title" though.

 

Note: This is from a SPO list

 

I am still new but this is boggling to me.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

Hi @Shane_Dev ,

I am assuming "Approve" is a Lookup field - you cannot sort on this. Try

SortByColumns(
   AddColumns(
      Filter(
         [@MyList], 
         StartsWith(
            Approve.Value, 
            TextSearchBox1.Text
         )
      ),
      "Approval",
      Approve.Value
   ),
   "Approval", 
   If(
      SortDescending1, 
      Descending, 
      Ascending
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

View solution in original post

5 REPLIES 5
Super User III
Super User III

Hi @Shane_Dev ,

I am assuming "Approve" is a Lookup field - you cannot sort on this. Try

SortByColumns(
   AddColumns(
      Filter(
         [@MyList], 
         StartsWith(
            Approve.Value, 
            TextSearchBox1.Text
         )
      ),
      "Approval",
      Approve.Value
   ),
   "Approval", 
   If(
      SortDescending1, 
      Descending, 
      Ascending
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

View solution in original post

Approve is a choice field (Yes, No, Empty)

That appears to have worked!

 

Now, one last question is how do i add another column to this list in the similar fashion. So lets say I want to add Status.Value as well as the Approve.Value

 

Is it as simple as just going:

SortByColumns(
    AddColumns(
		Filter(
        [@MyList],
        StartsWith(
            Approve.Value,
            TextSearchBox1.Text
			)
		), 
	    "Unicorns", 
		Approve.Value,
		"Test",
		Status.Value
	),
	"Test",
    If(
        SortDescending1,
        Descending,
        Ascending
    )
)

@Shane_Dev ,

Yes, that should work also.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Thanks! You the man!

 

I am still learning but this is pretty cool.

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 (70,958)