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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Collect table into a c...
Power Apps
Unanswered

Collect table into a collection as a nested table

(0) ShareShare
ReportReport
Posted on by 27

Hi,

The following results in a collection  NewColl, with three rows in it...
ClearCollect ( NewColl, Table ( { r1 : 1 } , { r1 : 2 } , { r1 : 3 } ) ) ;

 

However, if one or more fields are added to the row being collected, then the table is lost...

ClearCollect ( NewColl2, { Usr: "SomeUser", UsrId : 222 , RRevision : Table ( { r1 : 1} , { r1 : 2 } , { r1 : 3 } ) } ) ;

 

The expectation for the second collection was that the table would be treated as a nested table, much like when using the GroupBy function. Instead the table just disappears. See attached screenshots.

 

Both the above statements are accepted by the Intellisense as being ok syntactically.

 

Other similar problems occur with code examples below where they are all syntactically ok as far as Intellisense is concerned, but the nested table is lost in every case, whether the table is coded using the Table() function or a table is returned from the Split() function. This caused downstream problems when subsequent code was written on the basis that it was ok, because Intellisense didn't reject it. Is there a reason why tables can't be gathered as nested tables into collections in this fashion and if not, why didn't Intellisense display some kind of warning ?

 

ClearCollect(NewColl,
ForAll(ColRevisionReadHistory,
{Usr: ThisRecord.User, UsrId : ThisRecord.UserId, RRevision : Split(ThisRecord.ReadRevision,",")}));

 

Clear(NewColl);
ForAll(ColRevisionReadHistory,
Collect(NewColl,{Usr: ThisRecord.User, UsrId : ThisRecord.UserId, RRevision : Split(ThisRecord.ReadRevision,",")}));


Clear(NewColl);
ForAll(ColRevisionReadHistory,
Collect(NewColl,{Usr: ThisRecord.User, UsrId : ThisRecord.UserId, RRevision : Table({r1 : 1},{r2 :2},{r3 :3})}));


Clear(NewColl);
ForAll(ColRevisionReadHistory,
Collect(NewColl,Patch({Usr: ThisRecord.User, UsrId : ThisRecord.UserId}, {RRevision : Table({r1 : 1},{r2 :2},{r3 :3})})));


Clear(NewColl);
ForAll(ColRevisionReadHistory,
Collect(NewColl,Patch({Usr: ThisRecord.User, UsrId : ThisRecord.UserId}, {RRevision : Table({r1 : 1},{r2 :2},{r3 :3})})));


ClearCollect(NewColl, {Usr: "", UsrId : "", RRevision : Table()});
ForAll(ColRevisionReadHistory,
Patch(NewColl,{Usr: ThisRecord.User, UsrId : ThisRecord.UserId}, {RRevision : Table({r1 : 1},{r2 :2},{r3 :3})}));


ClearCollect(NewColl, {Usr: "", UsrId : "", RRevision : Table()});
ForAll(ColRevisionReadHistory,
Patch(NewColl,{Usr: ThisRecord.User, UsrId : ThisRecord.UserId}, {RRevision : Split(ThisRecord.ReadRevision,",")}));


ClearCollect(NewColl,
ForAll(ColRevisionReadHistory,
{Usr: ThisRecord.User, UsrId : ThisRecord.UserId, RRevision : [Split(ThisRecord.ReadRevision,",")]}));



 

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @flarebear 

    First, I am not sure if you think that it is lost because the formula editor shows nothing under it or if for some other reason.  But, you should be aware that the Formula Editor changed recently and it now shows an empty cell for where you used to see (table) in the past.  However...the table is still there as one would expect.  You just don't see it in the editor.

     

    So, your first formula is not only syntactically correct, but also would produce the results you are expecting...A table with records with a column that is text, a column that is numeric and a column that is a table.  The table column will have a table in it with (in your case) three records with a r1 numeric column.

     

    I hope this is helpful for you.

  • flarebear Profile Picture
    27 on at

    Thanks @RandyHayes ,
    Your answer is simultaneously reassuring and disconcerting. Reassuring to know that the table is still there. Disconcerting to know that the editor no longer displays the '[Table]' placeholder to represent a nested table. I can't imagine a good reason for that.

  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @flarebear 

    I share your reasoning.  I am sure it is a bug in the latest release version.  It's one of those "hope it comes back next time" kind of bugs.  Doesn't really impact the app, but would sure be nice to see again.

    Since they are aggressively working on that formula editor all the time, my guess is they just overlooked something in the latest release. (makes you wonder what else they overlooked!! 🤔 )

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard