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

Update multiple records in gallery X on change of a toggle in gallery Y

Hello everyone,

 

I am facing the below problem, and I haven't found a solution yet....

 

Background
I have 2 galleries:

Gallery X: Contains all the change requests (Gallery: Requests, SP List: Tracker). The requests have a column (request_status), which is by default "open" and with a toggle it can be switched to "closed"

 

Gallery Y: Contains all the actions needed to be taken around the above change requests (Gallery: Action_Gallery, SP List: Actions). The actions have a column (action_status), which have similar functionality to above

 

I want to achieve the following: When a person closes a request, I want all the related to the request actions to be closed.

 

I have tried the below syntax, on the change of the toggle of the 1st gallery, without success...

The request name exists in both SP lists and it's the primary key used to connect everything

ForAll(Actions,Patch(Actions, ID = Requests.Selected.ID,{action_status:"closed"}))
ForAll(Filter(Actions, LookUp(Tracker, ID = Requests.Selected.ID,Request_Name) = Request Name),Patch(Actions, ID = ID, {action_status:"closed"}))

 

Thank you!!!

10 REPLIES 10
Super User II
Super User II

@MadChemist 

If toggle1 is on galleryx set the default property of all the dependent toggles on galleryy to toggle1.Value. Set the OnChange of toggle 1 to do the patch.

Helper I
Helper I

@Drrickryp ,

This is simple and practical, however, I would also need to use a LookUp somewhere inside the dependent toggles, since I want only the related records to adjust, right? I will give it a try and come back to you.

When it comes to ForAll + Patch to create new records, there I have managed with a Collection
When it comes to adjusting existing records on a 2nd gallery by manipulating a toggle on a 1st gallery, it gets a bit trickier 🙂 

Super User II
Super User II

@MadChemist 

Isn’t galleryy already filtered on the primary key of galleryx?

Helper I
Helper I

No, it's not, it's getting filtered though by selecting some dropdowns (outside gallery) or tickbox (inside gallery).
99% the users will NOT have it filtered when they hit the toggle

Super User II
Super User II

@MadChemist 

Quick question, is the tracker list in a one-to-one or one-to-many relationship with actions?

Exactly, yes

Super User II
Super User II

@MadChemist 

Which is it, one-to-one or one-to-many?

Helper I
Helper I

Ah sorry, it's one (request) to many (actions).

my biggest issue is identifying the right structure for the record, inside the Patch. 
even the request_name(galleryY) = gallery.selected.request_name(galleryX)

Super User II
Super User II

@MadChemist 

Take a look at my blog post on keys and relationships https://powerusers.microsoft.com/t5/News-Announcements/Relational-Database-Principles-and-PowerApps-...  and the following one https://powerusers.microsoft.com/t5/News-Announcements/Relational-Database-Design-fundamentals-Imple...  on how to structure the database in PowerApps from data stored in SharePoint. I think we can come up with a solution for you.

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.

Top Solution Authors
Top Kudoed Authors
Users online (60,121)