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 / Storing duplicates wit...
Power Apps
Unanswered

Storing duplicates with patch

(1) ShareShare
ReportReport
Posted on by 88

Hey guys, 

 

I am trying to make an editable grid using a gallery, i am facing an issue where whenever i keep on save it doesnt override the previous records instead it adds to them in my data verse table.

 

so for my gallery this is the item for it: 

Filter('PO Supplies Details','IR Request ID' = SelectedItem.'IR Request Id')
 
then I have a button where its visibility is hidden where the grid update should happen: 

 

If(
 IsBlank(
 LookUp(
 colGridUpdates,
 'PO Supplies Detail' = ThisItem.'PO Supplies Detail'
 )
 ),
 Collect(
 colGridUpdates,
 ThisItem
 )
);
UpdateIf(
 colGridUpdates,
 'PO Supplies Detail' = ThisItem.'PO Supplies Detail',
 {
 'Expenditure Type': ExpenditureTypeInp.Text,
 'Deliverables ': DeliverablesInp.Text,
 'PO Id': NewPOID,
 'Date Promised ': DatePromisedInp.SelectedDate,
 Amount: Value(AmountInp.Text),
 'New Quantity ': Value(newQuantityInp.Text),
 'Previous Quantity ': Value(prevQuantityInp.Text),
 'New Unit Price': Value(newUnitPriceInp.Text),
 'Previous Unit Price': Value(preUnitPriceInp.Text),
 UOM: UOMInp.Selected.Value,
 WBS: WBSInp.Text
 }
);

 

the 'PO Supplies Detail', is the uniquely identifier from my table and then is my save functionality:

 

Patch(
 'PO Supplies Details',
 ShowColumns(
 colGridUpdates,
 'IR Request ID',
 'PO Id',
 'New Quantity ',
 'Date Promised ',
 'New Unit Price',
 'Expenditure Type',
 'Deliverables ',
 'Previous Quantity ',
 'Previous Unit Price',
 Amount,
 UOM
 )
);
Clear(colGridUpdates);

 

 

if anyone can help me with this i would really appreciate it and thank you.

Categories:
I have the same question (0)
  • Ami K Profile Picture
    15,687 Super User 2024 Season 1 on at

    @nunuNMS - from a Dataverse perspective your code looks fine to me.

     

    Is UOMInp a ComboBox? There is a long standing bug which causes the OnChange property to trigger whenever the Gallery is refreshed, thus the duplicates. If possible, remove the ComboBox and replace with a Dropdown control.

  • nunuNMS Profile Picture
    88 on at

    Hey there,

     

    No the UOMInp isnt a combo box its a dropdown menu, do you have any ideas on what could be causing this issue? thank you so much

     

  • Ami K Profile Picture
    15,687 Super User 2024 Season 1 on at

    @nunuNMS - nothing obvious to me. I would suggest removing one field from your code, and then run the Patch again. If duplicates continue to appear, remove another field and then run the Patch again. Keep doing this until you can pinpoint which field is causing the problem.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard