cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ThoNogueira
New Member

Separate delegable from non-delegable codes

I have a gallery that load items from sharepoint list.

When I put this code on 'Items':

 

 SortByColumns(
                'MyList';
                "ID";
                Descending
            )

the gallery works fine, loading items on demand.
 
But when I use this code:

If(
            false;
            SortByColumns(
                AddColumns(
                    Filter(
                        'MyList';
                        Status.Value = Status
                    );
                    "PriorityValue";
                    Priority.Value
                );
                "PriorityValue";
                Ascending;
            );
            SortByColumns(
                'MyList';
                "ID";
                Descending
            )
        )
 
the ondemand load stop working.

I know that AddColumns is non Delegable but, my expectation was the ELSE scope was Delegable but IF scope no.
Apparently all my code  became non.

There is any way of separating this two behaviors but still using it in the same gallery?
 
Thanks!
1 ACCEPTED SOLUTION

Accepted Solutions
Neha
Frequent Visitor

Hi @ThoNogueira ,

When you use a non-delegable functions in a formula , the whole formula is rendered non-delegable.
In this case AddColumn is non delegable. 
I think the solution here is to change the implementation of sorting choice column.
I would create another text column(hidden) and store the value of choice column in it during form submissions.
This will enable you to sort without any delegation issues.

Thanks,

Neha

View solution in original post

3 REPLIES 3
WarrenBelz
Super User III
Super User III

Hi @ThoNogueira ,

That is correct - if any part of a statement is non-Delegable, the whole statement becomes that way, so when it is sent to the data source, it "rejects" it and only returns the first record numbers up to your Delegation limit.

AddColumns is actually a "hidden" non-delegable function (you will not get a warning, but the output record numbers are limited as above.

However you have omitted the code at the top (where you have false) - is this also non-Delegable?

 

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.

Neha
Frequent Visitor

Hi @ThoNogueira ,

When you use a non-delegable functions in a formula , the whole formula is rendered non-delegable.
In this case AddColumn is non delegable. 
I think the solution here is to change the implementation of sorting choice column.
I would create another text column(hidden) and store the value of choice column in it during form submissions.
This will enable you to sort without any delegation issues.

Thanks,

Neha

View solution in original post

Hi Warren, thanks answering.
The code at the top is delegable. Is just a local variable that change the value when buntton is clicked. 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (37,083)