Notes for delegation when using “Sort” and “SortByColumns”|Comparison between SPO and Dataverse

Continuing from the last issue, I researched Sort and SortByColumns and delegation in detail.

スポンサーリンク

Delegation and Data Row Limit

Before we move on, look at the brief about “Delegation” and “Data Row Limit”·

Delegation means ” to leave the processing such as “Sort” and “Filter” to the data source”.

The idea is that it’s faster to have the data source deal with the process than bringing all the data to the Power Apps.

The “Data Row Limit” is the number of data (records) that Power Apps gets from the data source, and can be set to a maximum of 2000.

No more than the maximum amount of data will be loaded into Power Apps. Therefore, if you put large data into a variable or combo box, it will be got only the data equivalent to the limit you set.

However,“galleries” and “data tables” are an exception that can display data more than the data rows limit in case it it consists only of functions that can be delegated.

Advance preparations

Preparation is the same as before, with a SharePoint list like this,
and a Dataverse table as below.
To make it easier to see wether these data will be delegated, set the Power Apps “Data Row Limit” to 5.

Case that is NOT possible to be delegated with “SortByColumns”

Let’s see the result with SortByColumns function which is NOT able to delegate to data source.

Put an formula in the 2nd argument

First, “SortByColumns” cannot delegate if the second argument has formula.
※The gallery function cannot be used due to non-delegatable formula, and the “FFFF” item which should appear at the top of the list is not displayed because it hits Data Row Limit.
It’s bad… the same goes for Dataverse.
That’s too bad… It doesn’t work even if you put it in a text-type variable with “With” in advance.
So, “when you want to change the columns in which sorting is based on depending on the conditions, and delegate to data source simulatenaously”, it seems that the only way is to write more than one “SortByColumns” itself.

Well, it’s fine to write two or so…. but when there are more conditions, it’ll be hard for both reading and writing.
By the way, it is possible to put an expression in the third argument (ascending or descending order).

Put an formula in the 3rd argument.

Then, the method I introduced in the previous article, “Specifying a table as the third argument” cannot be delegated either.
※Records with column “Num” 6 won’t be displayed due to the sorting is done after bringing the data.
This also the same goes for Dataverse.

I know it is a rare case to specify a table to be passed, but you should be careful that there is no warning about delegation.

Case that is NOT possible to be delegated with “Sort”

Next, we’ll seethe case that is NOT possible to be delegated with “Sort”

Include an formula in the second argument.

As I mentioned in the previous article,“Sort” also can’t be delegated when the second argument contains an formula.
The same cannot be delegated in Dataverse.
According to the official document below, it says“Delegation is no longer possible when operators or functions are used.”
Understand delegation in a canvas app - Power Apps
Learn about how to use delegation to process large data sets efficiently in a canvas app.

When you want to delegate the processing to data source and still want to use any functions,“Sort” by itself can only do specifying one column, the same thing as “SortByColumns”.

For your information, when specifying multiple columns, you can “sort by multiple columns while delegating” by enclosing them with two ”Sort” functions.

Include object type properties in the formula

Also,accessing object properties with the second argument of the Sort function does not allow delegation(Example below is showing the access to choice column in SharePoint)
※Probably because “. “is the operator that accesses the property.

Conclusion

So,when you want to sort while keeping delegation, both “Sort” ane “SortByColumns” would be influenced by ristrictions.

When you need sorting to handle a large data, note that it would be unexpected result without care for delegation.

※Thare mey be other issues or cases that caused by delegation.

Extras1:It’s possible to delegate but the data limit influence the result when using “With”

If you use “With” for the Item property of the gallery as below, only the data for the data row limit will be displayed regardless of delegation.

Note that even if you do not use the value you put into a local variable in With, it will be affected by the data row limit.

Extars2:Combination with non-delegable functions as “AddColumns”

If you enclose the data with “AddColumns”, “sorting by the added columns” is NOT possible, but you can bring “the data after sorting” up to limit.
If you put AddColumns inside, you can “sort by the columns you add” but you have to bring the “data before sorting” up to limit.
This is the same for Dataverse.

You need to consider “what kind of data you want to display” or “what kind you don’t need “.

Related Articles

コメント

Copied title and URL