cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
lreinhard7
Level 8

Create datatable from multiple other datatables

Hi, 

I have in total 3 different datatables. 

All datatables hold different columns and I would like to combine different columns that I need in a new datatable. 

The linkage between the different datatables is made by a recid field that I can identify. 

Is it possible to select for example column 1 from datatableA, column 5 from datatableB and column 9 from datatableC and add those three columns into a new datatable?

Best regards, 

Ludwig

3 REPLIES 3
v-yutliu-msft
Level 10

Re: Create datatable from multiple other datatables

Hi @lreinhard7 ,

Could you tell me what data type are the columns that you want to combine with together?

I assume that they are text.

You could try this formula:

ClearCollect(test,
ShowColumns( AddColumns( table1, "column2", LookUp(table2, ID = fruit[@ID], columnname2),
"column3",
LookUp(table3,ID=fruit[@ID],columnname3)), "ID", "columnname1","column2","column3")
)

Here's a similar issue for your reference:

https://powerusers.microsoft.com/t5/General-Discussion/Syntax-for-joining-tables/td-p/61387

 

 

Best regards,

Community Support Team _ Phoebe Liu

 

 

lreinhard7
Level 8

Re: Create datatable from multiple other datatables

Hi,

I tried a 'baby step' first but already failed with this one.

Here is my example:

I have a datatable - GeneralLedgerActivities - for which I add all fields to a collection (Coll2) - see first and second screenprint

Then I have a second datatable - Main Accounts - where I filter a single account only. I would like to show this account in each row of the the collection coll2 by pressing the button that adds a column.

Unfortunately, this does not work and I receive a delegation warning instead that this might not work in large datasets.

I also tried using the [@MainAccountRecId] in the formula but this did also not work.

Do you have a tip for me?

Best regards,

Ludwig

 

 

 

 

 

 

 

 

v-yutliu-msft
Level 10

Re: Create datatable from multiple other datatables

Hi @lreinhard7 ,

I suggest you try this formula:

AddColumns(coll2,"AAA",LookUp(Mainaccounts,MainAccountRecId in coll2.MainAccountRecId,MainAccount))

 

Mainaccounts.MainAccountRecId and coll2.MainAccountRecId are two tables, they can't be used to compare.

 

As the problem of delegation, try to use delegatable functions.

If your records are smaller than 2000, then you could ignore the warning.

Here's a doc about delegation for your reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/delegation-overview

 

 

Best regards,

Community Support Team _ Phoebe Liu