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 Apps
Unanswered

RemoveIf and Patch

(0) ShareShare
ReportReport
Posted on by 6
I am at a loss..... 
 
 
I am using an EditForm. On this edit form, I am using a multiselect combo box.  This is a none to many relationship between a parent and child(ren).  There is a mapping table between them. 
 
My goal is to remove any records on the mapping table that is not longer selected on the combo box.  Then patch anything New or inserted. 
 
My thought process is to Run RemoveIf then Patch.  However, when I do this nothing works.  When I run RemoveIf on its own and Patch on its own the code runs. But one right after another it doesn't work. I tried to add the code in IfError and it appears that runs. However nothing is updated in the database.   My RemoveIF checks to select anything not selected in the combo box. 
 
I still can not get this to run correctly one right after another.  
 
I am confused. Any thoughts? 
 
Thanks! 
I have the same question (0)
  • WarrenBelz Profile Picture
    153,127 Most Valuable Professional on at
    Please share your code (in Text) including the RemoveIf and Patch code, the Items of the Combo Box and also some information on your data structure.
  • AP-30091349-0 Profile Picture
    6 on at
    My combo box setup looks something like this..... 
     
     
     
    My combo box is a multi select.    
    The backend is sql  with a mapping table between the lookup table and the Documents Transaciton table. 
     
    All of this is sitting on an EditForm back to table called Documents. 
     
    When I click the Save Button it will run SubmitForm(Form_AddEdit).  This will save the record correctly to the table Documents in sql. 
     
    My problem is, that it needs to take the Documents Key (After the Insert or Update), then take the selected Products key and dump them into the DocumentProductsMapping Table in SQL. 
     
     
    As part of the DocumentProductsMapping I need to be able to handle deletes. (Hard or soft I am struggling with both) 
     
    On the EditForm OnSuccess  I have tried multiple variations of this..    
    Each Indiviual piece works, however when I put them one right after another I can not get anything to Patch to the DB.   When I take it out of the IfError, it seems like the RemoveIF is not done running before the Patch runs.  
     
     
     
     
  • WarrenBelz Profile Picture
    153,127 Most Valuable Professional on at
    Firstly I am not an SQL user and you did not state your data source in your initial post, so there may be some data source related nuinances at play, whoever the first thing I see is that if no records are present to delete in your RemoveIf code, you will not get an error (so IfError is a waste of time) - it simply will not delete any records. This also means that the Patch will never run.
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee

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 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard