cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Adding "SortbyColumns" to the statemecauses "Incompatible type.

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! 
2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Super User
Super User

Re: Adding "SortbyColumns" to the statemecauses "Incompatible type.

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

View solution in original post

Highlighted
Frequent Visitor

Re: Adding "SortbyColumns" to the statemecauses "Incompatible type.

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!

View solution in original post

2 REPLIES 2
Highlighted
Super User
Super User

Re: Adding "SortbyColumns" to the statemecauses "Incompatible type.

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

View solution in original post

Highlighted
Frequent Visitor

Re: Adding "SortbyColumns" to the statemecauses "Incompatible type.

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!

View solution in original post

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,747)