web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / SortbyColumns does not...
Power Apps
Answered

SortbyColumns does not seem to work for a complex data type?

(0) ShareShare
ReportReport
Posted on by 35

I added a complex data type (choise in SharePoint) but I am having issues doing a SortByColumns on this newly added column that is listed in my DataTable. So I wonder if complex data types can be sorted? Thanks for any guidance.

Categories:
  • zmansuri Profile Picture
    6,048 Super User 2024 Season 1 on at

    SortByColumn(AddColumn(ListName,"ChoiceColumnNameTxt",ChoiceColumnName.Value),"ChoiceColumnNameTxt",Ascending)

     

    This will create simple text type column dynamically for your complex column. Which will not affect your actual list in anyway. and you can sort it.

  • Verified answer
    WarrenBelz Profile Picture
    156,530 Most Valuable Professional on at

    @BauwensER3 ,

    @zmansuri is correct except for slight misspelling. 

    SortByColumns(
     AddColumns(
     ListName,
     "ChoiceColumnNameTxt",
     ChoiceColumnName.Value
     ),
     "ChoiceColumnNameTxt"
    )

    You also do not need Ascending as it is inferred (but will work fine).

    I point I need to make you aware of is that this in not Delegable and will only results within your (500-2,000) Delegation limit. You might re-think if you actually need the complex field type involved as mostly all of this can be done in Power Apps writing back to Text fields. I have a blog that may interest you on this.

     

    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.

  • zmansuri Profile Picture
    6,048 Super User 2024 Season 1 on at

    Can you write a blog where you can explain how to implement this? I mean instead of complicated columns use text column in real app. 

    Thanks

  • WarrenBelz Profile Picture
    156,530 Most Valuable Professional on at

    Hi @zmansuri ,

    I have not used Lookup columns in many years. You simply base a combo box or a drop-down on the other list you want to look up. A combo box is handy if you want another field in the list. All that is needed then is the Update of the card to be changed to the output of the dropdown (DropdownName.Selected.xxxx)

  • zmansuri Profile Picture
    6,048 Super User 2024 Season 1 on at

    I have used Text field for LookUp and Person. But, not choice type. Your method would be obviously more elegant, so i thought i can compare.

  • WarrenBelz Profile Picture
    156,530 Most Valuable Professional on at

    @zmansuri ,

    Choice is even easier unless you want multiple Choices (when you do need a Choice column) - just hard-code the choices in the drop-down as you would in Sharepoint

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 409 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 252 Most Valuable Professional

Last 30 days Overall leaderboard