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 / Multiple Value Patch n...
Power Apps
Unanswered

Multiple Value Patch new record and update existing record

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi ,

I have an Excel Like Editable Grid that is using a PowerBIIntegration.Data as a data source,

Whenever user save the Gallery (this Data will store the record in another list)  or 

I want to update an Request_ID if it already exists 

Here is what my logic looks like right now...

ForAll( 'Electrical-Gallery'.AllItems,
If(
 IsBlank(
 LookUp(
 'BSD CAD Tracker Electrical Mechanical',
 Request_ID = TextInput2_2.Text
 )
 ),
 Patch( 'BSD CAD Tracker Electrical Mechanical',
 Defaults('BSD CAD Tracker Electrical Mechanical'),
 { 
 Request_ID:TextInput2_2.Text,
 SAP_Part_Number:TextInput5_2.Text,
 Family_Code: ComboBox1.Selected.Family_Code,
 IEC_BLOCK: TextInput6_6.Text
 }
 );
 Notify("Data Saved Success",NotificationType.Success),
 Patch( 'BSD CAD Tracker Electrical Mechanical',
 { 
 Request_ID:TextInput2_2.Text,
 SAP_Part_Number:TextInput5_2.Text,
 Family_Code: ComboBox1.Selected.Family_Code,
 IEC_BLOCK: TextInput6_6.Text
 }
 );
Notify("Existing Data Saved Success",NotificationType.Success)
)
)



in this above code New Items saved successfully but Updated already Exists item not working it will create the Duplicates

I've been banging my head for weeks now, I don't know how to fix

 

 

Thanks

Ranga

Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    To start, your formula has the ForAll backward. You are trying to use it like a ForLoop in some development language - which PowerApps is not.  ForAll is a function that returns a table of records based on your iteration table and record schema.

    It is more efficient to use the function as intended and will provide better performance.

     

    Next, what is the primary key of your datasource and is your BI data providing that primary key?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @RandyHayes    

     

    Request_ID  is the Primary Key

     

    tried  this code also but it's  create the Duplicate Row items

     

    Patch(BSD CAD Tracker Electrical Mechanical,
     ForAll(
     Filter(),
     {
     ID: ID,
     }
    )
    )

     

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    So to be clear...this is NOT a SharePoint datasource!

     

    If Request_ID is the primary key, then your formula should be:

    Patch(BSD CAD Tracker Electrical Mechanical,
     ForAll(
     Filter(),
     {
     Request_ID: Request_ID,
     }
    )
    )
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @RandyHayes    

     

    yes SharePoint is not my data source,  for example purpose i have added  ID:ID

    but it's  create the Duplicate Row items, if already exits Update the same row item   how to i achieve this?

     

     

    i tried this one ,

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    Patch will do that automatically.  

    If the primary key is blank, then Patch will create the record.  If the primary key has a value, then patch will find and update that corresponding record.

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @RandyHayes 

     

    @Nogueira1306  can you please help me on this issue

    It's not working ,  when I click save I'm getting error,  before that no error

    Ranga_Raj_0-1662115161105.png

    This is the code

     

    Patch(BSD,
     ForAll(
     Filter(Gallery1_2.AllItems, Toggle1_1.Value=true),
     {
     ID: ID,
     Request_ID: TextInput1_2.Text,
     Family_Code: ComboBox4_2.Selected.Family_Code,
     SAP_Part_Number: TextInput2_6.Text,
     IEC_BLOCK: TextInput3_2.Text 
     }
     )
    )

     

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 352 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 323

#3
Mohsin Ali Profile Picture

Mohsin Ali 226

Last 30 days Overall leaderboard