Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building 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.

  • Ami K Profile Picture
    15,665 Super User 2024 Season 1 on at
    Re: Storing duplicates with patch

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

  • nunuNMS Profile Picture
    88 on at
    Re: Storing duplicates with patch

    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,665 Super User 2024 Season 1 on at
    Re: Storing duplicates with patch

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

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,653 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard