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

Notifications

Announcements

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,989 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard