web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Master toggle, with ch...
Power Apps
Answered

Master toggle, with child toggle control

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I've been racking my brain on this for a bit too long.  I have a form with a master toggle control (MT) that I want to control child toggles (CT) in a gallery.  If the MT is changed, I want all CT's to change. However, I want to retain the ability to toggle the CT's independently as well.  In the screen shot below, the top toggle is the MT, and the other's are CT's in a gallery (1 CT per record). 
1.png
The collection of the gallery contains the default value: ThisItem.IsPending.  I have this working today by using an UpdateIF statement: 
UpdateIf(PendingEquipmentCollection, StartDate = DateValue(TreeGallery.Selected.Entity), {IsPending: IsPendingMasterToggle.Value})

This all works, I can control the master, and child toggles independently since the collection is updated that the CT uses as a defalut value (ThisItem.Ispending). 

My issue: I've added a new textinput control and I've discovered that when the values are toggled since I'm updating the values in the collection, my textinput text is lost:

2.png

3.png

The check mark has new patch logic to save the comments, but they are wiped out by toggle changes. I've been trying to figure out how to control the toggles through variables, but can't seem to get my head wrapped around it since the CT's are inside a gallery and need to be able toggle independently from the MT.

Anyone have some thoughts on how I can accomplish this?

Thanks!

Categories:
  • v-siky-msft Profile Picture
    Microsoft Employee on at

    @Anonymous 

     

    There are two workaround:

    1. save the text into collection once it is entered

    2. just change the toggle value, and use the check icon to save the toggle value to collection.

     

    1.

    Set the following codes to OnChange property of Textinput box in gallery:

    Patch(PendingEquipmentCollection, ThisItem, {TextColumn: TextInput1.Text})

    Snipaste_2020-02-04_15-19-04.png

    2.

    Set the Main Toggle OnChange property: Set(Var1,MT.Value) 

    Set the CT Default property: If(IsBlank(Var1),IsPending,Var1)Snipaste_2020-02-04_15-18-57.png

    Sik

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi  v-siky-msft,

     

    Unfortunately #2 doesn't work, as it doesn't allow independent toggling of the child toggles.  This was the original issue I ran into.  If you set the child toggles to the master toggle value, you lose the ability to change the child toggle values.  The reason I need this level of control is in the gallery there might be 10 records showing, and 9 of the 10 need to be the same value as the master toggle.  But one of the records does not.  So, toggle master to set all, and then unchecking the one record is what the user wants.  

     

    PS: Love the images you used 😉

  • v-siky-msft Profile Picture
    Microsoft Employee on at

    Ok @Anonymous 

    What about the first workaround.

    Does it make sense for your case?

    Sik

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I solved the issue by doing the following:

    Created a variable conMasterToggleValue with a default value of false

     

    Master Toggle.Default = conMasterToggleValue

    Master Toggle.OnCheck = UpdateContext({conMasterToggleValue: true})

    Master Toggle.OnUnCheck = UpdateContext({conMasterToggleValue: false})

     

    Child Toggle: If(conMasterToggleValue = false, !ThisItem.IsPending, conMasterToggleValue)

     

    This allowed independent control of the toggles, and the user could click save which then wrote the textbox/toggle control values to a collection.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 139

Last 30 days Overall leaderboard