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 / Separate delegable fro...
Power Apps
Answered

Separate delegable from non-delegable codes

(0) ShareShare
ReportReport
Posted on by 6

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!
Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,373 Most Valuable Professional on at

    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.

  • Verified answer
    Neha Profile Picture
    30 on at

    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

  • ThoNogueira Profile Picture
    6 on at

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

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

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 429 Most Valuable Professional

#2
11manish Profile Picture

11manish 191 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 122 Super User 2026 Season 2

Last 30 days Overall leaderboard