cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

How to remove specific multiple items from the Data Source which is bound to Gallery?

I want to implement the solution in which two galleries are there (Source and Destination). There has to be multiple items selected in the source gallery and press the button which would copy the selected items to destination gallery. I want to do the vice-a-versa operation as well.

 

To loop through inside the gallery items to check which item has been selected, I have used ForAll function. Once I find the checkbox is checked which is placed in the gallery template then I am adding to the destination gallery's data source and removing it from the source data source. 

 

When I am trying to implement it, it is just removing first item only inside ForAll function. It is not removing rest of the items.

The Screen:

 
 

Below are the formulas I have used to copy from source to destination for onSelect property of ">" button:

 

 

 

 

ForAll(glrSourceMembers.AllItems, If(Checkbox1.Value = true, Collect(SelectedItems, {User : USER, UID: ID}); RemoveIf(SourceItems, ID = ID)));

 

 

 

 

 

But when I am selecting 2 items from the source gallery and pressing > button, then it copies selected items in to the destination gallery but also all items are deleted from the source gallery. What I want to do is that, those selected items only should be removed, remaining unchecked items should remain there in the source gallery.

 

Kindly let me know what is the wrong thing am I doing here.

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Hi @Anonymous ,

Could you please share a bit more about your scenario?

Do you want to copy the selected items from your source Gallery into your Destination Gallery, and then remove the selected items from your Source Gallery?

 

I have made a test on my side, please consider take a try with the following workaround:

Add a "Copy" button outside the source Gallery, set the OnSelect property to following:

ForAll(
       RenameColumns(Filter(glrSourceMembers.AllItems, Checkbox1.Value = true), "ID", "ID1"),
       Collect(SelectedItems, {User: USER, UID: ID1});RemoveIf(SourceItems, ID = ID1)
)

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Dual Super User II
Dual Super User II

Hi @Anonymous 

 

The issue here is with the ID=ID in the expression, due to same name this is always returning true and hence deleting all the rows. Can you try to update the expression to below expression:

ForAll(glrSourceMembers.AllItems, If(Checkbox1.Value = true, Collect(SelectedItems, {User : USER, UID: ID}))); RemoveIf(SourceItems, ID in Filter(glrSourceMembers.AllItems, Checkbox1.Value=true).ID)

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

 

 

Community Support
Community Support

Hi @Anonymous ,

Could you please share a bit more about your scenario?

Do you want to copy the selected items from your source Gallery into your Destination Gallery, and then remove the selected items from your Source Gallery?

 

I have made a test on my side, please consider take a try with the following workaround:

Add a "Copy" button outside the source Gallery, set the OnSelect property to following:

ForAll(
       RenameColumns(Filter(glrSourceMembers.AllItems, Checkbox1.Value = true), "ID", "ID1"),
       Collect(SelectedItems, {User: USER, UID: ID1});RemoveIf(SourceItems, ID = ID1)
)

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (20,469)