cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
EpicTriffid
Resolver I
Resolver I

Sudden delegation error on collection?!

Afternoon!

 

 

SortByColumns(AddColumns(
    GroupBy(unitData, "Unit_x0020_Name","Units"),
    "Unit Code",
    First(Units).'Unit Code',
    "Teaching Hours",
    Sum(Units,'Teaching Hours'),
    "Prep Hours",
    Sum(Units,'Preparation Hours'),
    "# Students",
    Sum(Units, 'Number of Students'),
    "Assessment Hours",
    Max(First(Units).'Assessment Hours'),
    "# Staff",
    CountRows(Distinct(Units,StaffID)),
    "Unit Size",
    First(Units).'Unit Credits',
    "Level",
    Left(First(Units).'Unit Credits',2),
    "Credits",
    Right(First(Units).'Unit Credits',2)
    ),"Unit_x0020_Name",Ascending)

 

 

Above I have a CountRows against a collection ("# Staff") that until literally today had no problems, but no is showing me a delegation erros stating:

 

"The CountRows part of this formula may not work correctly on large data-sets as its direct inner function blocks the delegation of all upper-level functions"

 

One, I've no idea what that means, two, why am I getting delegation errors against a collection, and three, why did it just appear today?

1 ACCEPTED SOLUTION

Accepted Solutions
Boneckrh19
Kudo Kingpin
Kudo Kingpin

I am having a similar problem in my applications, though I am not using a collection. But there were no delegation warnings yesterday and there are today. Not sure how to go about fixing this as I don't know what "inner functions" they mean, but I have opened a ticket with Microsoft.

https://powerusers.microsoft.com/t5/Building-Power-Apps/Sudden-delegation-warning-SortByColumns-and-...

View solution in original post

6 REPLIES 6
JayMagness
Solution Specialist
Solution Specialist

Hi,

 

Is it an error or warning...

 

Did you just pass 2000 records or 500 records in the storage location?

 

Lastly I have been fighting Delegation issues in LASTN and Filter for a week with support, there does seem to me to be an issue.

 

Jay

RandyHayes
Super User
Super User

@EpicTriffid 

Can you describe more about what unitData is?  If that is a datasource, then you will see the warning you have.  If that is a collection, then there is something else strange going on.

If it is a dataSource, consider the following change to your Formula:

With({groupData: GroupBy(unitData, "Unit_x0020_Name","Units")},

    SortByColumns(
        AddColumns(groupData,        
            "Unit Code", First(Units).'Unit Code',
            "Teaching Hours", Sum(Units,'Teaching Hours'),
            "Prep Hours", Sum(Units,'Preparation Hours'),
            "# Students", Sum(Units, 'Number of Students'),
            "Assessment Hours", Max(First(Units).'Assessment Hours'),
            "# Staff", CountRows(Distinct(Units,StaffID)),
            "Unit Size", First(Units).'Unit Credits',
            "Level", Left(First(Units).'Unit Credits',2),
            "Credits", Right(First(Units).'Unit Credits',2)
        ),
       "Unit_x0020_Name",
       Ascending
    )
)

 

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hi @RandyHayes ,

 

Yes, unitData is a collection I take with the OnVisible property on the screen:

 

ClearCollect(unitData,
        Filter(
        '[dbo].[Units]',
        'Academic Year' = currentAY,
        Department = currentDept));

 

As far as I was aware, delegation isn't an issue with collections?

 

@EpicTriffid 

Yes, that is not normal on a collection.

Did you try the formula that I provided anyway?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hi @RandyHayes 

 

I did try it, and while the functioned as the old one, I still get the same error on the CountRows.

Boneckrh19
Kudo Kingpin
Kudo Kingpin

I am having a similar problem in my applications, though I am not using a collection. But there were no delegation warnings yesterday and there are today. Not sure how to go about fixing this as I don't know what "inner functions" they mean, but I have opened a ticket with Microsoft.

https://powerusers.microsoft.com/t5/Building-Power-Apps/Sudden-delegation-warning-SortByColumns-and-...

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,072)