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 / Patch many records (10...
Power Apps
Unanswered

Patch many records (10000 row SP List)

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi,

 

I have a PowerApp that reads from a SP List with ~10000 rows. Each user of the app could have approximately 600 rows assigned to them. When the app loads onstart a collection is created with only the records associated to that user and the collection is used for read purposes only. The user needs to update the columns "Intensity" from a dropdown [Low, Medium, High] and the column "Date" from a date picker. An example of the data is displayed in the following table. 

 

Customer_IDLevelDate
1000Low 
1000Low 
1000Low 
1000Low 
1001Medium 
1001Medium 
1001Medium 
1002High 
1002High 

 

I have loaded "Customer_ID" in a gallery. I need to update only the intensity for one Customer_ID, in the above example for Customer_ID = 1000 change "Intensity" to "Medium" and captures the date. However, due to the size of the dataset I'm not sure if I can use ForAll due to being non-delegable. Is there any other way I can do this? If there's no concern in using ForAll, how do I code this?

Categories:
I have the same question (0)
  • mrsimoncarter Profile Picture
    2 on at

    Hey,

     

    Maybe set the OnChange property of the dropdown and the date picker to patch the item in the SP list?

     

    That way, only items that were updated would be sent to SP, cutting down on the load with non-delegable queries.

     

    Simon

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @Anonymous 

    Another alternative would be to put an icon or button inside the gallery to Patch() the datasource.  That way the user would have to make a conscious decision to alter the record. 

    Patch(datasource,ThisItem,{CustomerID: control1.value, Level: control2.value, Date:datepicker1.SelectedDate, etc.})

    One of the fields being patched should be the users ID.  You would need to ClearCollect() your collection once the patch executed. 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @Drrickryp ,

     

    But will this Update all the other records that have the same Customer_ID? Which is what I need it to do.

     

    I've got it to work with UpdateIf, but I'm trying to avoid any potential delegation issues. 

  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous :

    Do you want to update the Level field of multiple records?

    Please consider take a try with ForAll function to achieve your needs.

    I’ve made a test for your reference:

    My data source: ‘List A’

    Column (click to edit)

    Type

    Customer_ID

    Single line of text

    TheLevel

    Single line of text

    TheDate

    Date and Time

    Case1:Use forall and patch

    1\Add a DropDown control(Customerid)

    Items: 

     

    Distinct('List A',Customer_ID)

     

    2\Add a DropDown control(thelevel)

    Items:

     

    ["Low","Medium","High"]

     

    3\Add a button

    OnSelect:

     

    ForAll(
     RenameColumns(
     Filter(
     'List A',
     Customer_ID = Customerid.SelectedText.Value
     ),
     "ID",
     "TheID" 
     ), /* Change the field name to eliminate ambiguity*/
     Patch(
     'List A',
     LookUp(
     'List A',
     ID = TheID
     ),
     {
     TheLevel: thelevel.SelectedText.Value,
     TheDate: Today()
     }
     )
    )

     

    Case2:Use update if

    1\Add a DropDown control(Customerid)

    Items: 

     

    Distinct('List A',Customer_ID)

     

    2\Add a DropDown control(thelevel)

    Items: 

     

    ["Low","Medium","High"]

     

    3\Add a button

    OnSelect:

     

    UpdateIf(
     'List A',
     Customer_ID = Customerid.SelectedText.Value,
     {
     TheLevel: thelevel.SelectedText.Value,
     TheDate: Today()
     }
    )

     

     

    Best Regards,

    Bof

    1.jpg
    2.png
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @v-bofeng-msft ,

     

    Will I not have an issue with ForAll in case 1 and UpdateIf in case 2 as a result of delegation? The datasource has ~>10000 records.

     

    I initially used, UpdateIf and it worked and then I realised that I could get a delegation issue as a result of UpdateIf. At the moment, I have 120 records in the datasource. I am planning to do a bulk upload of the 10000 soon.

     

    Thanks.

  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous :

    I don't think you need to worry about that:

    Power Apps provides warning (yellow triangle) when you create a formula that contains something that can't be delegated.

    Delegation warnings

    Best Regards,

    Bof

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I think you may be right.

     

    I did a simulation of it to test performance and uploaded 75k records into SP. Then I assigned my user 1026 records, from the 30000th row position onwards, and loaded it into a collection. I used UpdateIf and it worked. It gave me no delegation warning and it updated all the records correctly!

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 474

#1
Valantis Profile Picture

Valantis 474

#3
WarrenBelz Profile Picture

WarrenBelz 375 Most Valuable Professional

Last 30 days Overall leaderboard