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 / Adding "SortbyColumns"...
Power Apps
Answered

Adding "SortbyColumns" to the statemecauses "Incompatible type.

(0) ShareShare
ReportReport
Posted on by 22

Hello,
 
Would you please help with the following.
There is a statement that works perfectly:

 

Set(SelectedObjectName, First(Filter('[dbo].[Objects]', ParentObjectId = WorkingParentObjectId)).Name)

 

Now I need to sort data output before taking the first record. I use SortByColumns function, like this:

 

Set(SelectedObjectName, First(SortByColumns(Filter('[dbo].[Objects]', ParentObjectId = WorkingParentObjectId), "SortOrder")).Name)

 

And immediately get "Incompatible type..." error, like below:
 
Incompatible type error.PNG
I assume that this is because delegation cannot be used and statement cannot be resolved.
Does anybody know work-around? 
Thank you! 
Categories:
I have the same question (0)
  • Verified answer
    mdevaney Profile Picture
    29,991 Moderator on at
    @DenisSkorskiy
    Actually, it’s because SortColumns is missing an argument


    Set(SelectedObjectName, First(SortByColumns(Filter('[dbo].[Objects]', ParentObjectId = WorkingParentObjectId), “YourSortColumn1”, Ascending)).Name)

    —-
    Please Accept as Solution if this post answered your question so others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.
  • Verified answer
    DenisSkorskiy Profile Picture
    22 on at

    It is very strange.

    In the reference it is said that SortOrder is optional.

    Just for the sake of curiosity, I set this third parameter - and error disappeared.

    Needless to say that I use this function with just two parameters in other places of the application and it works perfectly.

     

    mdevaney, thank you!

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 339 Most Valuable Professional

#2
11manish Profile Picture

11manish 180

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 88 Super User 2026 Season 1

Last 30 days Overall leaderboard