Showing results for 
Search instead for 
Did you mean: 
Community Champion
Community Champion

Unable to Clear Nested Collection

Weirdest thing. 

  • OnVisible of Screen:
    • Intantiate a nested Collection with a blank record then Clear the collection
    • ClearCollect(colStatus,
                          Level3_A: {
                              ID: " ",
                              Indicator: " "
  • Label on Screen:
    • Text property: CountRows(colStatus)
    • Results: 1
  • The colStatus record:
    • The first record in the Gallery.
    • Each record in the Gallery has a toggle that Collects data. 
    • But the toggle is NOT toggled by me OnVisible...

When a screen loads, does the first Toggle in a Gallery "flip" to whatever the default is set to? Maybe this is whats happening? 

To mitigate, I added a .001 second timer to the screen OnTimerEnd Clear(colStatus) and it works without user noticing... but still ..? Weird!


Community Support
Community Support

Hi @ericonline ,

Could you please share a bit more about your scenario?

Do you want to clear Nested Collection from a Collection?

Further, do you want the Toggle control to "flip" to whatever the default is set to when you load your screen?


I found that you have posted similar issue within this forum, please check my response within the following thread:

If you want to clear nested Collection from a Collection, please take a try with the solution I provided within above thread.


In addition, if you want the Toggle control to "flip" to whatever the default is set to when you load your screen, I think the OnVisible property could achieve your needs.

I assume that you add a Status column ("Y" or "N") in your colStatus collection to store the Toggle value as below (set the OnVisible proeprty of the screen to following😞

                  Level2: Table({
                      Level3_A: {
                          ID: " "
                      Level3_B: {
                          Indicator: " ",
                          Status: "Y"    /* <-- Store the Toggle value */

Add Gallery control, set the Items property to following:


Within the Gallery, set the Default property of the Toggle control to following:

First(ThisItem.Level2.Level3_B).Level3_B.Status = "Y",

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.

Helpful resources

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,799)