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 / 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,679 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,679 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

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