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

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
Level 8

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
Mike8
Level 10

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
Level 8

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
Level 8

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
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 68 members 3,472 guests
Please welcome our newest community members: