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 III
Super User III

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (68,595)