cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Community Champion
Community Champion

Re: Can't sort by Choice Value with SortByColumns

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
Highlighted
Community Champion
Community Champion

Re: Can't sort by Choice Value with SortByColumns

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

Highlighted
New Member

Re: Can't sort by Choice Value with SortByColumns

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

Highlighted
New Member

Re: Can't sort by Choice Value with SortByColumns

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
    )
)
Highlighted
Community Champion
Community Champion

Re: Can't sort by Choice Value with SortByColumns

@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.

Highlighted
New Member

Re: Can't sort by Choice Value with SortByColumns

Thanks! You the man!

 

I am still learning but this is pretty cool.

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

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

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,989)