cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Bogdan
Level: Powered On

Create Nested Collections

Hello everyone,

I am trying to build some nested collections:
=============================
ClearCollect(
colEintritt,
{
colCheckliste: {
colStandardsoftware: {
Standardsoftware: galStandardSoftware.Selected.lbl_Office365_2.Text,
angefordert: galStandardSoftware.Selected.Checkbox1.Value,
installiert: galStandardSoftware.Selected.Checkbox1_1.Value
},
colOptionaleSoftware: {
optSoftware: galOptionaleSoftware.Selected.lbl_Office_Project.Text,
angefordert: galOptionaleSoftware.Selected.Checkbox1_22.Value,
installiert: galOptionaleSoftware.Selected.Checkbox1_23.Value
},
colBerechtigungen: {
Laufwerke: txt_Laufwerke.Text,
angefordert: galBerechtigungen.Selected.Checkbox1_32.Value,
installiert: galBerechtigungen.Selected.Checkbox1_33.Value
}
},
Mitarbeiter: DataCardValue2.Selected.DisplayName,
Computername: DataCardValue3.Text,
Ticketnummer: DataCardValue4.Text
}
)
=============================
With the above, it works with only one row (record) being showed.
How can I add multiple rows in the 3rd Level Collection ?

colEintritt.pngcolEintritt_2.pngcolEintritt_3.png


With the method I know, it does not work:
colEintritt_4.png

Any respone would be appreciated. I can't go further because of this.

Thank you in advance !


1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: Create Nested Collections

To get multiple records at any level for a field you need to specify those records as an array of records.  Take a look at this sample. Level 3 is specified as an array using square brackets.

ClearCollect(
    nestedCollection,
    {
        Title: "Level 1A",
        Level2: {
            Title2: "Level 2A",
            Level3: [
                {Title3: "Level 3A"},
                {Title3: "Level 3B"}
            ]
        }
    },
    {
        Title: "Level 1B",
        Level2: {Title2: "Level 2B"}
    }
)


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

3 REPLIES 3
Dual Super User
Dual Super User

Re: Create Nested Collections

To get multiple records at any level for a field you need to specify those records as an array of records.  Take a look at this sample. Level 3 is specified as an array using square brackets.

ClearCollect(
    nestedCollection,
    {
        Title: "Level 1A",
        Level2: {
            Title2: "Level 2A",
            Level3: [
                {Title3: "Level 3A"},
                {Title3: "Level 3B"}
            ]
        }
    },
    {
        Title: "Level 1B",
        Level2: {Title2: "Level 2B"}
    }
)


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

Bogdan
Level: Powered On

Re: Create Nested Collections

Hi,

Thanks! This is close, if not exactly what I need.
One more question - is this the only solution as Value Arrays ? Is it not possible as simple data Records ?

{

                Standardsoftware: galStandardSoftware.Selected.lbl_Office365_2.Text,

                angefordert: galStandardSoftware.Selected.Checkbox1.Value,

                installiert: galStandardSoftware.Selected.Checkbox1_1.Value

            },

{

                Standardsoftware: galStandardSoftware.Selected.lbl_Office365_2.Text,

                angefordert: galStandardSoftware.Selected.Checkbox1.Value,

                installiert: galStandardSoftware.Selected.Checkbox1_1.Value

            }

Dual Super User
Dual Super User

Re: Create Nested Collections

From what I've tested the first level assumes that multiple records are in an array (collection). But for any additional levels you must declare them explicitly.  If you take the collection and look at it in JSON format you can see that multiple records are always in an array. So, no I don't think you can nest multiple records at a different level in the same field unless they are put into an array.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,125)