cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

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
Highlighted
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
Highlighted
Resolver V
Resolver V

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

Highlighted
Super User III
Super User III

@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. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!
Highlighted

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?

 

Highlighted

@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. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!
Highlighted

Hi @RandyHayes 

 

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

Highlighted
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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (10,844)