Forum

How to expand list ...
 
Notifications
Clear all

How to expand list of tables generated from list.generate function and append columns of each table

7 Posts
2 Users
0 Reactions
212 Views
(@slingxx)
Posts: 4
Active Member
Topic starter
 

I have generated a dynamic list of tables using list.generate function. May I know how to expand each table from list and append columns of each tables. Column 2 is reference column and append Column 3 of each table.

 
Posted : 22/05/2022 3:06 am
(@catalinb)
Posts: 1937
Member Admin
 

Hi Tan,

Can you clarify please? Hard to see your structure.

You have the list of tables in a list object? Or it's just in a new column in a table object?

 
Posted : 24/05/2022 12:39 am
(@slingxx)
Posts: 4
Active Member
Topic starter
 

Hi Catalin,

It is the list of tables in a list object. Actually I would like to perform looping function but I don't know how to write the iteration code. The looping step is to get the table data from table in list position 0, then append column 3 of the table to a reference column. Then perform the loop for next table.list.png

 
Posted : 24/05/2022 10:43 am
(@catalinb)
Posts: 1937
Member Admin
 

Hi Tan,

You can convert the list to a table and expand only column 3, this will provide a single column result.

Not sure what means appending to a reference column, where is that reference column?

For example, the following line will take a list of tables (Custom1) and combines then one by one, at each iteration, starting from an empty table #table({},{}) :
= List.Accumulate(Custom1,#table({},{}),(current,state)=>state & (current))

 
Posted : 29/05/2022 3:23 am
(@slingxx)
Posts: 4
Active Member
Topic starter
 

Hi Catalin,

I able to generate list of tables. Each table has same column headers [Column2] and [Results]. The number of tables in the list is more than hundreds. I would like to perform like table.nestedjoin function for [Column2] and append each [Results] of table. I am thinking to use list.accumulate but it would have same column name for each iteration of joining. May I know how to solve this?

Source is list of tables.

Table.NestedJoin(Source{0}, {"Column2"}, Source{1}, {"Column2"}, "Final", JoinKind.LeftOuter)

list-1.png

 
Posted : 29/05/2022 7:22 am
(@catalinb)
Posts: 1937
Member Admin
 

You can use this step, assuming that PreviousStepName is a list of tables:

= Table.FromColumns(List.Skip(List.Accumulate(PreviousStepName,{{}},(state,current)=> state & {current[Results]} ),1))

 
Posted : 30/05/2022 9:05 am
(@slingxx)
Posts: 4
Active Member
Topic starter
 

Hi Catalin,

It works and solved. Thanks much.

 
Posted : 31/05/2022 10:39 pm
Share: