cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
David283
Helper II
Helper II

Writing all records from one gallery to another. And Filtering one gallery with records from another.

@RandyHayes

Or anyone else that is willing to assist 🙂

 

In my app, I am trying to setup a feature where users are selected from a first list and added to a second list to be able to view and order an item.  So to that end I have 2 galleries and 2 collections with some buttons that move records between them.

David283_0-1623082751902.png

 

The left gallery is 'GalVisibleChosen' and it displays the users that have been selected and will eventually be patched out to a SharePoint list that contains the ItemID and the UserName/Email that will be able to order this item.  For now it is connected to collection 'ColVisiblePerson'.

 

The second gallery is called 'GalLocations' and displays the collection 'ColLocations'.  ColLocations is populated directly from a SharePoint list that includes several text fields including UserNames and Emails.

 

Both Collections are created and populated when the edit screen becomes visible = 

 

 

OnVisible = 
ClearCollect(ColLocations, OALocation);
If(ItemEditForm1.Mode <> FormMode.View, ClearCollect(ColVisiblePerson, {DisplayName:"", Mail:""}));
Clear(ColVisiblePerson)

 

 

(I had to add that final clear, or my first option in the gallery was a blank username)

 

My Left and right facing arrows both work fine:

Left (this needs a check for duplicate feature, will add that later)=

 

 

Patch(ColVisiblePerson,Defaults(ColVisiblePerson),{DisplayName:GalLocations.Selected.Title,Mail:GalLocations.Selected.UserEmail})

 

 

And Right=

 

 

Remove(ColVisiblePerson, LookUp(ColVisiblePerson, DisplayName=GalVisibleChosen.Selected.DisplayName))

 

 

 And the bottom clear all button also works = 

 

 

RemoveIf(ColVisiblePerson, true)

 

 

 

My problem is 2 remaining areas, my second to last button is an "Add All" button to add all records from Gal2 to Gal1 (but not duplicates).  And my second problem is filtering on Gal2, if a name is already in Gal1, it should disappear as an option in Gal2

 

I attempted this for the 'Add All' button, but it just wrote the same username and email multiple times = 

 

 

ForAll(GalLocations.AllItems, Patch(ColVisiblePerson,Defaults(ColVisiblePerson),{DisplayName:GalLocations.Selected.Title,Mail:GalLocations.Selected.UserEmail}))

 

 

 

And nothing I have tried for filtering has even half worked...

 

Could anyone assist with these 2 problem areas?

15 REPLIES 15

Changes made.

 

For saving edits to the 'OAItemList' or saving a new item, I have 3 buttons on the top of the ItemEditScreen, 

Update button = SubmitForm(ItemEditForm1); ResetForm(ItemEditForm1); Back()

Save new button = Patch(OAItemList, Defaults(OAItemList), ItemEditForm1.Updates); ResetForm(ItemEditForm1); Back()

And a delete button = Remove(OAItemList, ItemListGallery.Selected); Back()

 

Each have visibility settings to only appear when the form is in the correct mode.

As for saving the selections from the Collection to the OAItemRelation list, I haven't written that part yet, still trying to get a collection with the right names, then I will probably try to figure out the patch commands to retrieve the ItemID from OAItemList and patch each record from 'ColVisiblePerson' to 'OAItemRelation' including the ItemID (probably saved in a variable).

RandyHayes
Super User III
Super User III

@David283 

We'll need to make some adjustments!!  Considering that you want to be able to edit (add/remove) when you edit the record, there are some changes that need to be considered.

I have you post marked in my tracking system, so I will get back with you shortly on this as I need to attend to a few other things.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Thank you sir, please take your time, this isn't urgent.

Would you have a chance today or tomorrow to look at this again with me?

RandyHayes
Super User III
Super User III

@David283 

Sorry for my delay on this.  I still have it marked in my tracking.  

I will take a look over it if I can today or tomorrow and give you some solutions you can use.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

At your convenience senpai. 😊😊

 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,563)