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 / Delegation warning in ...
Power Apps
Suggested Answer

Delegation warning in patch with lookup

(1) ShareShare
ReportReport
Posted on by 8
   I'm having issues with Patching to Dataverse with the below formula. There are more than 2000 lines at this point and will continue to grow. 
 
 
   
Categories:
I have the same question (0)
  • Nandit Profile Picture
    1,568 Moderator on at
     
    I'd suggest you first save your data in a collection within the app on OnStart. You can use the following code for it to collect more than 2000 items in a collection:
    Set(
        firstRecord,
        First(WeeklyEngagements)
    );
    Set(
        lastRecord,
        First(
            Sort(
                WeeklyEngagements,
                ID,
                Descending
            )
        )
    );
    Set(
        iterationsNo,
        RoundUp(
            (lastRecord.ID - firstRecord.ID) / 500,
            0
        )
    );
    Collect(iterations, Sequence(iterationsNo,0));
    
    ForAll(
        iterations,
        With(
            {
                prevThreshold: Value(Value) * 500,
                nextThreshold: (Value(Value) + 1) * 500
            },
            If(
                lastRecord.ID > Value,
                Collect(
                    colWeeklyEngagements,
                    Filter(
                        WeeklyEngagements,
                        ID_val > prevThreshold && ID_val <= nextThreshold
                    )
                )
            )
        )
    );
     
     
    You can use colWeeklyEngagements just like you are using WeeklyEngagements throughout the app. 
       
    Kind regards, 
    Nandit
     
    If this answers your query, please mark this response as the answer.
    If its helpful, please leave a like. Thanks!
     
  • Suggested answer
    HL-17091633-0 Profile Picture
    8 on at
    So this is great, but it's not finding the record when patching back to the dataverse table. 
  • WarrenBelz Profile Picture
    156,064 Most Valuable Professional on at
    I am suspecting that either KeyA is a number or you are using a Modern control. Also if those other controls are in the gallery, you need to specify either ThisRecord or an As statement as below. If KeyA is a number
    ForAll(
       Gallery2.Allltems As _Data,
       Patch(
          WeeklyEngagements,
          LookUp(
             WeeklyEngagements, 
             KeyA = Value(Keylnfo.Text)
          ),
          {
             'July 1': Value(_Data.jul1.Text), 
             'July 8': Value(_Data.jul8.Text),
             'July 15': Value(_Data.jul15.Text)
          }
       )
    )
    If you are using a Modern control, you need
    KeyA = Keylnfo.Value
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee
     
  • HL-17091633-0 Profile Picture
    8 on at
    I feel like we are getting closer.  Still getting a "file not found" when patching.  KeyA is a text field as it shows the "employee id _ client number" which the client number leads with a letter.  No delegation warnings though.  Just not sure why It's not able to find the record as the gallery is populated directly from the Dataverse table, so the record is there, it's just not writing back to it. 

    It's only writing the last record changed back to Dataverse.  Is there a way to save for all the changes made?
     
    I've tried deleting the record in the Dataverse table, then re-adding.  Sometimes this works but most of the time it doesn't.
     

    I'm not using any modern controls at this point either. 
     
    ForAll(
        Gallery2.AllItems As _Data,
        If(
            Not(
                IsBlank(
                    LookUp(
                        WeeklyEngagements,
                        KeyA = KeyInfo.Text
                    )
                )
            ),
            Patch(
                WeeklyEngagements,
                LookUp(
                    WeeklyEngagements,
                    KeyA = KeyInfo.Text
                ),
                {
                    'July 1': Value(jul1.Text),
                    'July 8': Value(jul8.Text),
                    'July 15': Value(jul15.Text),
                    'July 22': Value(jul22.Text),
                    'July 29': Value(jul29.Text),
                    'Aug 5': Value(aug5.Text),
                    'Aug 12': Value(aug12.Text),
                    'Aug 19': Value(aug19.Text),
                    'Aug 26': Value(aug26.Text),
                    'Sept 2': Value(sep2.Text),
                    'Sept 9': Value(sep9.Text),
                    'Sept 16': Value(sep16.Text),
                    'Sept 23': Value(sep23.Text),
                    'Sept 30': Value(sep30.Text),
                    'Oct 7': Value(oct7.Text),
                    'Oct 14': Value(oct14.Text),
                    'Oct 21': Value(oct21.Text),
                    'Oct 28': Value(oct28.Text),
                    'Nov 4': Value(nov4.Text),
                    'Nov 11': Value(nov11.Text),
                    'Nov 18': Value(nov18.Text),
                    'Nov 25': Value(nov25.Text),
                    'Dec 2': Value(dec2.Text),
                    'Dec 9': Value(dec9.Text),
                    'Dec 16': Value(dec16.Text),
                    'Dec 23': Value(dec23.Text),
                    'Dec 30': Value(dec30.Text),
                    Team: LookUp(
                        'Recurring Teams Assignments',
                        'Employee ID' = KeyInfo_1.Text,
                        'Team No'
                    )
                }
            ),
            Notify(
                "Record not found",
                NotificationType.Error
            )
        )
    );
  • WarrenBelz Profile Picture
    156,064 Most Valuable Professional on at
    Hi
    You need to have the _Data (or whatever you want to call it) prefix on any control that is inside the gallery (much the same as using ThisRecord, but I find As totally reliable). Try this but remove _Data. if the control is not in the gallery.
    ForAll(
       Gallery2.AllItems As _Data,
       If(
          !IsBlank(
             LookUp(
                WeeklyEngagements,
                KeyA = _Data.KeyInfo.Text
             )
          ),
          Patch(
             WeeklyEngagements,
             LookUp(
                WeeklyEngagements,
                KeyA = _Data.KeyInfo.Text
             ),
             {
                'July 1': Value(_Data.jul1.Text),
                'July 8': Value(_Data.jul8.Text),
                'July 15': Value(_Data.jul15.Text),
                'July 22': Value(_Data.jul22.Text),
                'July 29': Value(_Data.g5.Text),
                'Aug 12': Value(_Data.aug12.Text),
                'Aug 19': Value(_Data.aug19.Text),
                'Aug 26': Value(_Data.aug26.Text),
                'Sept 2': Value(_Data.sep2.Text),
                'Sept 9': Value(_Data.sep9.Text),
                'Sept 16': Value(_Data.sep16.Text),
                'Sept 23': Value(_Data.sep23.Text),
                'Sept 30': Value(_Data.sep30.Text),
                'Oct 7': Value(_Data.oct7.Text),
                'Oct 14': Value(_Data.oct14.Text),
                'Oct 21': Value(_Data.oct21.Text),
                'Oct 28': Value(_Data.ct28.Text),
                'Nov 4': Value(_Data._Data.nov4.Text),
                'Nov 11': Value(_Data.nov11.Text),
                'Nov 18': Value(_Data.nov18.Text),
                'Nov 25': Value(_Data.nov25.Text),
                'Dec 2': Value(_Data.dec2.Text),
                'Dec 9': Value(_Data.dec9.Text),
                'Dec 16': Value(_Data.dec16.Text),
                'Dec 23': Value(_Data.dec23.Text),
                'Dec 30': Value(_Data.dec30.Text),
                Team: 
                LookUp(
                   'Recurring Teams Assignments',
                   'Employee ID' = _Data.KeyInfo_1.Text,
                   'Team No'
                )
             }
          ),
          Notify(
             "Record not found",
             NotificationType.Error
          )
       )
    );
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee

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

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 337 Most Valuable Professional

#2
11manish Profile Picture

11manish 173

#3
Valantis Profile Picture

Valantis 86

Last 30 days Overall leaderboard