web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

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

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:
I have the same question (0)
  • RandyHayes Profile Picture
    76,297 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
    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,297 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
    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,297 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
    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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard