cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Issue with deleting items in gallery

Hi, I'm having an issue with a delete icon in each Gallery item. The code is as below, and for some reason if I don't have the SaveData() code it won't delete the item (sometimes it'll only successfully delete the top item). But if I only have the remove() function it'll delete as it should. I've also tried to call a Timer outside the Gallery to use the SaveData() function but if that code's in there it'll give me the same result as if I had the SaveData() back in. But I know the SaveData() works, because if you deleted the item, the "Back" and "Proceed" buttons have the SaveData() functions in them and if you deleted and hit one of those buttons it would work. I'm wanting the SaveData() in the delete icon, as the photos are saved until they're dealt with or deleted. (also attached is an image of what the Gallery looks like)
Many thanks!


Delete Icon Code:

If(
    ThisItem.IsSelected,
    Remove(
        PhotoCollection,
        ThisItem
    );
    SaveData(
        PhotoCollection,
        "tempCameraStorage"
    )
);

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Issue with deleting items in gallery

Hi @Hench ,

 

I can't get your point. What do you want to achieve?

The formula you post doesn't make any sense, 'ThisItem.IsSelected' always returns true when the delete icon is selected, so only remove function can be triggered.

 

In addition, there is also a potential mistake. Since you are trying to remove items from collection,  the entire record must match. Reference from Remove function . However, What 'ThisItem' returns doesn't match the entire record, which also contains some control information within the gallery.

The workaround is to use LookUp function to retrieve the entire record from collection through Unique identifier field.

Remove(PhotoCollection, LookUp(PhotoCollection, GUIDField=ThisItem.GUIDField))

 

Sik

 

View solution in original post

1 REPLY 1
Highlighted
Community Support
Community Support

Re: Issue with deleting items in gallery

Hi @Hench ,

 

I can't get your point. What do you want to achieve?

The formula you post doesn't make any sense, 'ThisItem.IsSelected' always returns true when the delete icon is selected, so only remove function can be triggered.

 

In addition, there is also a potential mistake. Since you are trying to remove items from collection,  the entire record must match. Reference from Remove function . However, What 'ThisItem' returns doesn't match the entire record, which also contains some control information within the gallery.

The workaround is to use LookUp function to retrieve the entire record from collection through Unique identifier field.

Remove(PhotoCollection, LookUp(PhotoCollection, GUIDField=ThisItem.GUIDField))

 

Sik

 

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,012)