Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Multiple Value Patch new record and update existing record

(0) ShareShare
ReportReport
Posted on by

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

  • Community Power Platform Member Profile Picture
    on at
    Re: Multiple Value Patch new record and update existing record

    @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 
     }
     )
    )

     

  • RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on at
    Re: Multiple Value Patch new record and update existing record

    @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
    on at
    Re: Multiple Value Patch new record and update existing record

    @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,287 Super User 2024 Season 1 on at
    Re: Multiple Value Patch new record and update existing record

    @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
    on at
    Re: Multiple Value Patch new record and update existing record

    @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,287 Super User 2024 Season 1 on at
    Re: Multiple Value Patch new record and update existing record

    @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?

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 1