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

Removing items from gallery conditionally making changes at the datasource.

Hello,

 

I have a gallery (datasource in Sharepoint) that is filtered according to the person logged in as the source contains a person filed associated with each entry. It looks like this:

image.png

What I am trying to do is ask people if they are still part of a Committee. If they click on "I am no longer part of this committee", it should remove that entry from that datasource and also from the gallery (Which I am able to accomplish).

 

When people click on "Yes, I am still in", it should remove that item from the gallery (giving user the feeling that they have tackled that entry) but not from the datasource. This is what I am having trouble with.

 

Any ideas?

 

Thank you in advance

 

@Pstork1 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User
Dual Super User

Re: Removing items from gallery conditionally making changes at the datasource.

The gallery just shows a filtered and sorted list of what is in the datasource.  For the functionality that you describe I would create a copy of the datasource records that are shown in the gallery, then point the gallery at the collection, not the datasource.  Then you can either delete records from the collection when they click I'm in.  Or maybe create an additional yes/No column that is toggled on that record when they click.  Then filter the gallery based on that column being No.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

3 REPLIES 3
Highlighted
Dual Super User
Dual Super User

Re: Removing items from gallery conditionally making changes at the datasource.

The gallery just shows a filtered and sorted list of what is in the datasource.  For the functionality that you describe I would create a copy of the datasource records that are shown in the gallery, then point the gallery at the collection, not the datasource.  Then you can either delete records from the collection when they click I'm in.  Or maybe create an additional yes/No column that is toggled on that record when they click.  Then filter the gallery based on that column being No.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

Highlighted
Helper I
Helper I

Re: Removing items from gallery conditionally making changes at the datasource.

Hello,

I was able to solve it. I fetched the filtered list as a collection on OnStart of the application and then displayed it as a gallery. On OnClick of "Yes, I am still in", I removed the entry from the collection only (Select(Parent);Remove(CollectionName,ThisItem)) but on OnClick of "I am no longer part of this committee" I actually removed the item from the datasource and then ClearCollected the collection again:

 Select(Parent);RemoveIf(SPDataSource,Title=Gallery1.Selected.Title);Refresh(SPDatasource);ClearCollect(CollectionName,Filter(SPDataSource,Lower(Right(Member.Claims,Len(glbUserEmail)))=Lower(glbUserEmail)).Title) 

Highlighted
Dual Super User
Dual Super User

Re: Removing items from gallery conditionally making changes at the datasource.

Yes, that's pretty much what I figured it should look like.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (10,346)