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

Remove an item from a collection that is populated with an attachment control

I have a collection that is completed when you add an attachment to an attachment control in the case of adding a file. I put the following formula

Collect(
Excels,
{
First Name: Last(attExcel.Attachments) .Name,
DataStream: Last(attExcel.Attachments) .Value
}
)

 

Now, in case the attachment in the control is deleted, I also want to remove it from the collection

Do you have any idea how to achieve this?

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @King ,

You just need to ClearCollect the remaining attachments

ClearCollect(
Excels,
   {
      First Name: attExcel.Attachments.Name,
      DataStream: attExcel.Attachments.Value
   }
)

I do this on every attach and delete - simply creates a new collection with the current attachments.

If you don't need to rename the fields 

ClearCollect(
   Excels,
   attExcel.Attachments
)

This will have two fields - Name and Value. The Value will show as an image in an image control if required.

 

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

5 REPLIES 5
Super User III
Super User III

Hi King,

Just collect again on the OnRemoveFile property of the attachment control.

 

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.

Helper V
Helper V

nevermind he's got ya

Hi @WarrenBelzthanks for answering

 

I did what he told me and what he does is create a new blank record in the collection without deleting the previous one.

Hi @King ,

You just need to ClearCollect the remaining attachments

ClearCollect(
Excels,
   {
      First Name: attExcel.Attachments.Name,
      DataStream: attExcel.Attachments.Value
   }
)

I do this on every attach and delete - simply creates a new collection with the current attachments.

If you don't need to rename the fields 

ClearCollect(
   Excels,
   attExcel.Attachments
)

This will have two fields - Name and Value. The Value will show as an image in an image control if required.

 

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

Hi @WarrenBelz 

Thank you  for your help, what helped me in my case was the second formula indicated by you.

 

ClearCollect (
Excels,
attExcel.Attachments
)

which forced me to rename my collection columns called

FirstName and DataStream to
Name and value

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (7,024)