cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gargoolgala
Level 8

Remove Item from Browse Gallery

Hi,

I have a gallery with a checkbox based on a sharepoint list. All I want to do is remove the selected items from the sharepoint list - which then in turn will update my gallery list.

 

I can use this:

Remove(CustomerDeviceList,DeviceGallery.Selected)

 

This only removes 1 item - I cannot find the syntax for RemoveIf which seems it should run through the records and compare to a value in the list - problem is I want to just compare to the checkbox if it is true or not which is not in the list

 

I looked at ForAll but I get an error stating I cannot use the same data source i the forall as the remove option which makes me think I need to create a temporary collection and add items in to it on check and then delete them all

 

I am hoping I do not need to do this - this is supposed to be a powerusers app - not a programmers app and many workarounds I am finding for many things seem to make me think this is not being built with power users in mind.

 

If anyone can tell me how this can be achieved it would be appreciated.

5 REPLIES 5
Super User
Super User

Re: Remove Item from Browse Gallery

Hello Gargoolgala,

If CustomerDeviceList was a collection, this formula works. I hope its the same for the sharepoint list.

Be careful, ColumnName should have unique items for that record. A GUID for example, that is not the same on a different record.

Clear(TempCol);
ForAll(DeviceGallery.AllItems,
Collect(TempCol,{UniqueField:ColumnName});
If(Checkbox1.Value,
Remove(CustomerDeviceList,LookUp(CustomerDeviceList,Last(TempCol).UniqueField=ColumnName))))

Gargoolgala
Level 8

Re: Remove Item from Browse Gallery

I have  not had a chance to test this yet as I had to fisrtly get a unique ID to the field to be deleted - this was achieved today and I now need to test this further.

 

Although I still think as a Power Users tools this is overkill to achieve what should be a simply request using RemoveIf

Super User
Super User

Re: Remove Item from Browse Gallery

Hello Gargoolgala,

I agree with you.
There may be an easier way of doing what you need. If you find it, I will use it, too. Please let me know.

Gargoolgala
Level 8

Re: Remove Item from Browse Gallery

Mike8,

 

this worked for me - no need for a collection - much simpler.

 

RemoveIf(CustomerDeviceList,LookUp(DeviceGallery.AllItems, ID=CustomerDeviceList[@ID]).Device.Value)

 

I need to get my head around the @Fields but it works a treat 🙂

 

I found it here

https://powerusers.microsoft.com/t5/General-Discussion/Editing-multiple-records-in-Gallery-control/t...

 

It is not the solution on the page but the best approach, it was posted by Steelman a bit down the 1st page.

Super User
Super User

Re: Remove Item from Browse Gallery

Hello Gargoolgala,

Perfect. Your formula is indeed much simpler.
I also need to understand, how we should use @Fields.
I understand the idea but I have problems using it. The documentation could be better if it had examples.

Thank you Gargoolgala 🙂

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,107)