cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Super User
Super User

Unable to Clear Nested Collection

Weirdest thing. 

  • OnVisible of Screen:
    • Intantiate a nested Collection with a blank record then Clear the collection
    • ClearCollect(colStatus,
          Table(
              {
                  Level2:
                  Table(
                      {
                          Level3_A: {
                              ID: " ",
                          },
                          Level3_B:{
                              Indicator: " "
                          }
                      }
                  )
              }
          )
      );
      
      Clear(colAirStatuses)
  • 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!

 

1 REPLY 1
Highlighted
Community Support
Community Support

Re: Unable to Clear Nested Collection

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:

https://powerusers.microsoft.com/t5/General-Discussion/Toggle-Mindboggle/m-p/258427#M75604

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😞

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

Add Gallery control, set the Items property to following:

colStatus

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

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

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

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,983)