cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DemosCY
Helper I
Helper I

Remove Details from my Expense Details

I have create 2 List in share point. One is Called Local Purchase order and next one ExpenseDetails.

 

I have create a delete option for LPO in power apps and i want when i delete 1 LPO to delete also details from ExpenseDetails how is this possible?

 

i use the below:

Remove('Local Purchase Order - List', MasterGallery.Selected);If (IsEmpty(Errors('Local Purchase Order - List', MasterGallery.Selected));, Back()); UpdateContext({showdeletelpo:false}) ;Notify( "LPO Has been Deleted", NotificationType.Success, 0 ); Navigate(ViewScreen)

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @DemosCY ,

Using the field names you have supplied, try this

UpdateContext(
   {
      vRefID:
      MasterGallery.Selected.ID
   }
);
RemoveIf(
   'Local Purchase Order - List',
   ID=vRefID
);
If(
   !IsBlank(
      LookUp(
         ExpenseDetails,
         MasterID=vRefID,
         MasterID
      )
   ),
   RemoveIf(
      ExpenseDetails,
      MasterID=vRefID
   )
);
UpdateContext({showdeletelpo:false});
Notify("LPO Has been Deleted", NotificationType.Success, 0 ); 
Navigate(ViewScreen)

 

Please click Accept as solution 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 Thumbs Up.

View solution in original post

6 REPLIES 6
WarrenBelz
Super User
Super User

Hi @DemosCY ,

You have not mentioned the linking field between these lists - I have used the ID of the primary list and below - change to whatever fields you are linking them on

UpdateContext({vRefID:MasterGallery.Selected.ID})
RemoveIf(
   'Local Purchase Order - List', 
   ID=MasterGallery.Selected.ID
);
If(
   !IsBlank(
      Lookup(
         ExpenseDetails,
         YourRef=vRefID,
         vRefID
      )
   ),
   RemoveIf(
      ExpenseDetails,
      YourRef=vRefID
   )
)

I have not added the rest of your code.

 

Please click Accept as solution 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 Thumbs Up.

 

Hi Warren

 

thank you for your response, linking field is the ID

 

i dont know if i understand it correctly:

 

Capture.PNG

@DemosCY ,

Firstly, can you please post code as Text also - very had to transcribe an image.

Secondly, you need to use the linking field in the secondary list, not ID on the second list.

Hi Warren

 

1 List should be LPO and 2nd Expense Details

 

it should work against ID and MasterID

 

sorry but i am kind new in powerapps 🙂

 

UpdateContext({vRefID:MasterGallery.Selected.ID});RemoveIf('Local Purchase Order - List',ID=MasterGallery.Selected.ID);If(!IsBlank(LookUp(ExpenseDetails,MasterID=ID,ID)),RemoveIf(ExpenseDetails,MasterID=ID));UpdateContext({showdeletelpo:false});Notify( "LPO Has been Deleted", NotificationType.Success, 0 ); Navigate(ViewScreen)

Hi @DemosCY ,

Using the field names you have supplied, try this

UpdateContext(
   {
      vRefID:
      MasterGallery.Selected.ID
   }
);
RemoveIf(
   'Local Purchase Order - List',
   ID=vRefID
);
If(
   !IsBlank(
      LookUp(
         ExpenseDetails,
         MasterID=vRefID,
         MasterID
      )
   ),
   RemoveIf(
      ExpenseDetails,
      MasterID=vRefID
   )
);
UpdateContext({showdeletelpo:false});
Notify("LPO Has been Deleted", NotificationType.Success, 0 ); 
Navigate(ViewScreen)

 

Please click Accept as solution 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 Thumbs Up.

View solution in original post

that works

 

thank you very much appreciate the help!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,670)