cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gargoolgala Resolver II
Resolver II

Filter on visible items in gallery

Hi, I need to loop through all the items in a gallery and delete them from a sharepoint table. I only want the items visible in the gallery list and are for the particular customer. I do not want to have to check any of the items.

 

I can do it so that all the customers records are deleted but I need to limit it to only the visible items in the current list - which changes based on a different filter.  I have this below - I have put where I am stuck - **How do I filter so it only loops through the visible items in the gallery*****

 

ForAll(
Filter(
DeviceList.AllItems,
**How do I filter so it only loops through the visible items in the gallery*****
),
RemoveIf(
CustomerDeviceList,
CustomerID = SelectedCustomer.ID And DeviceID = DeviceID
)
)

 

Will I need to add in a flag of some sort that is true if it is an active item in the list? Or is there a way to say something like IsVisible(Column)=true

 

Any assistance is appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Gargoolgala Resolver II
Resolver II

Re: Filter on visible items in gallery

Seems like I resolved it.  It was the matching name between the sharepoint list column and the field in PA - they were the same and it was confusing it. I changed the field in the gallery to DeviceListID and it then gave me the Text option and all is good.

 

So Mike8 you were right in that Gallery.AllItems only looks at the visible items - it was my syntax of doubling up on names

 

ForAll(
DeviceList.AllItems,
RemoveIf(
CustomerDeviceList,
CustomerID = SelectedCustomer.ID And DeviceID = DeviceListID.Text
)
);

View solution in original post

3 REPLIES 3
Super User
Super User

Re: Filter on visible items in gallery

Hello Gargoolgala,

You can try..


RemoveIf(CustomerDeviceList,ID in DeviceList.AllItems.ID)


I am not sure if this is what you need to do. The expression above will delete from the sharepoint list, CustomerDeviceList, all the records that exist in the gallery, DeviceList . I assume that the DeviceList gallery has as Items the sharepoint list CustomerDeviceList

 

Edit:  If you want to use your expression
**How do I filter so it only loops through the visible items in the gallery**
If you iterate on DeviceList.AllItems it only iterates on the records that the gallery displays (the visible records). You don't need to Filter (DeviceList.AllItems,, ....)

ForAll(
DeviceList.AllItems,
RemoveIf(
CustomerDeviceList,
CustomerID = SelectedCustomer.ID And DeviceID = DeviceID
)
)

Gargoolgala Resolver II
Resolver II

Re: Filter on visible items in gallery

Mike8, thanks for the response.  This is the first thing I tried but it deletes all the devices for that customer - I need it to only delete the devices for the customer IF they are visible in the gallery.

 

You say it only iterates on the visible items but this seems wrong as it is deleting for all - even though I am only looking at a filtered gallery list.

Gargoolgala Resolver II
Resolver II

Re: Filter on visible items in gallery

Seems like I resolved it.  It was the matching name between the sharepoint list column and the field in PA - they were the same and it was confusing it. I changed the field in the gallery to DeviceListID and it then gave me the Text option and all is good.

 

So Mike8 you were right in that Gallery.AllItems only looks at the visible items - it was my syntax of doubling up on names

 

ForAll(
DeviceList.AllItems,
RemoveIf(
CustomerDeviceList,
CustomerID = SelectedCustomer.ID And DeviceID = DeviceListID.Text
)
);

View solution in original post

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

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