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 / Flatten a Table with N...
Power Apps
Unanswered

Flatten a Table with Nested Data

(0) ShareShare
ReportReport
Posted on by 27

I'm using the Flow Management connector to return information about the environments available to my App. The data comes as a JSON structure, which I'm pulling into a collection by each Environment using:

ClearCollect(EnvList, Flow.ListUserEnvironments().value);

 

The structure is a Single row in the collection for each environment with headings of Location, Name and Properties (Single row nested table).

 

I'm trying to flatten the table for use in a DropDown, which currently won't let me use EnvList.Properties.DisplayName, so I'm using the following to re-write the collection at the properties level, but I really need the environment "Name" value too..

 

ForAll(EnvList, Collect(EnvironmentListForDD,properties));

 

So I've tried several iterations to try and expand the table, flattening the properties table out, but to no avail.

ClearCollect(TestList,ShowColumns(EnvList,"name","properties"))

 

Any ideas gratefully received.

 

Categories:
I have the same question (0)
  • Cimares Profile Picture
    27 on at

    Data returned from FlowManagement.ListUserEnvironmentsData returned from FlowManagement.ListUserEnvironments

    It didn't seem to like my picture first time round.. this is the Top level collection

  • Verified answer
    v-yutliu-msft Profile Picture
    on at

    Hi @Cimares ,

    Do you want to get nested table data which means all the "EnvList.Properties.DisplayName" in your issue?
    If so, please try this formula:

    Clear(DisplayNamecollection);
    ForAll(EnvList,Collect(DisplayNamecollection,{DisplayName:Properties.DisplayName}))

    Then the DisplayNamecollection will collect all the display names.

    The syntax should be like:

    Clear(collectionname);
    ForAll(originaltable,Collect(collectionname,{fieldname in collection :fieldname in originaltable}))

    Here's a similar issue for your reference:
    https://powerusers.microsoft.com/t5/Building-Power-Apps/How-to-access-nested-table-values/td-p/313821

     

     

    Best regards,

  • Cimares Profile Picture
    27 on at

    Many thanks Phoebe, that pointed me in the right direction.. I didn't have a problem accessing the nested properties, but what I needed was a way to rebuild the table with the properties flattened into a single row. By modifying your sample slightly, it achieved what I needed!

     

    Clear(DisplayNamecollection);
    ForAll(EnvList,Collect(DisplayNamecollection,{DisplayName:properties.displayName,Name:name}))

     

    Where Name is the same level of object as properties in the Parent...

  • ELove Profile Picture
    15 on at

    I know this topic is old. I had a similar issue but with a table with a one column containing a record. Based on your example I did the following:

     

    ClearCollect(TestCollection,AddColumns(EnvList,"displayName",Properties.displayName,"otherItem",Properties.ootherItem,...))

     

    If the item is a nested single Row Table  instead of a record you need to encase it in a First() function:

     

    ClearCollect(TestCollection,AddColumns(EnvList,"displayName",First(Properties).displayName,"otherItem",First(Properties).otherItem,...))

     

    This prevents using the ForAll and having to loop. Your new collection will contain all of the data from the original collection and the flattened Columns from the nested table/record. You can drop the Column that was flattened if you wish.

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 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard