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

How to fix this delegation error?

Hi all!

 

I've managed to get rid of all the delegation warnings in my app through the use of collections, better filters etc. I'm stuck on one though!

 

ClearCollect(
    submittedRecords,
    ForAll(
        'TA Gallery Add Delivery Styles'.AllItems,
        Patch(
            'Unit List',
            Defaults('Unit List'),
            {
                'User Name': 'TA - Value - Name'.Text,
                'MMU ID': 'TA - Value -  ID'.Text,
                'Unit Name': 'TA - Value - Unit Name'.Text,
                'Unit Credits': Text('TA - Dd - Unit Credits'.SelectedText.Value),
                'Delivery Style': Text('TA - Dd - Delivery Style'.SelectedText.Value),
                'Hours per Session': Value('TA - Value - Hours'.Text),
                'Number of Sessions': Value('TA - Value - Sessions'.Text),
                'Teaching Hours': Value('TA - Value - Pre Total Hours'.Text),
                'Prep Hours': Value('TA - Value - Pre Total Sessions'.Text),
                'Academic Year': Text('Admin - Dd - Academic Year'.SelectedText.Value)
            }
        )
    )
);
Patch(
    'Unit List',
    LookUp(
        'Unit List',
        ID = First(submittedRecords).ID),
    {
        'Number of Students': Value('TA - Value - # Students'.Text),
        'Assessment Allocation': Value('TA - Value - Assessment Allocation'.Text)
    }
);

To summarise the above, I generate a collection of records that I submit, and patch them over to my SP list. However, as you can add multiple enteries under the same record title, I only want my "Number of Students" and "Assessment Allocation" to be copied once, so that when I report, I won't have the remove the duplicate values. 

 

However, when I send those single records here:

 

Patch(
    'Unit List',
    LookUp(
        'Unit List',
        ID = First(submittedRecords).ID),
    {
        'Number of Students': Value('TA - Value - # Students'.Text),
        'Assessment Allocation': Value('TA - Value - Assessment Allocation'.Text)
    }
);

The lookup for the record ID brings back a delegation warning. My only thought is that either its the usage of First, or that the arguments are different types? This is the offending line. The equals and the .ID are the ones with warnings:

 

ID = First(submittedRecords).ID)

 

Can anyone help please?

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User
Super User

Hi @EpicTriffid 

I would try storing the ID value in a variable, and then referring to that in your call to LookUp. Perhaps that might resolve the problem.

 

Set(FirstSubmittedID, First(submittedRecords).ID);
Patch( 'Unit List', LookUp( 'Unit List', ID = FirstSubmittedID, { 'Number of Students': Value('TA - Value - # Students'.Text), 'Assessment Allocation': Value('TA - Value - Assessment Allocation'.Text) } );

View solution in original post

1 REPLY 1
timl
Super User
Super User

Hi @EpicTriffid 

I would try storing the ID value in a variable, and then referring to that in your call to LookUp. Perhaps that might resolve the problem.

 

Set(FirstSubmittedID, First(submittedRecords).ID);
Patch( 'Unit List', LookUp( 'Unit List', ID = FirstSubmittedID, { 'Number of Students': Value('TA - Value - # Students'.Text), 'Assessment Allocation': Value('TA - Value - Assessment Allocation'.Text) } );

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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