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

Populating Data Table from 3 Tables based on LookUp ( like INNERJOIN )

Hi Experts,

Issue: Need to populate a table on change of drop down which is build up of 3 tables ( 1 main table and 2 Look Up tables - kind of INNERJOIN in SQL).

I am using SQL as a backend.

 

Achieved: I am able to achieve the Lookup on 1 table at max using ShowColumn and AddColumns under 'Items' of the Data Table.

 

Something like this I have done: 

ShowColumns(
    AddColumns(
        Orders,
        "CustomerName",
        LookUp(Customers, CustomerId = Orders[@CustomerId], CustomerName)),
    "OrderId", "CustomerName", "OrderDate")

 

Source which helped me: https://powerusers.microsoft.com/t5/General-Discussion/Syntax-for-joining-tables/m-p/61425#M25380

 

Not Achieved

Now I want to add a column which is an ID field in another table and want to get the Description based on the Lookup.

 

Let me know on how to do this? Any quick help will be much appreciated.

 

Note: I have not tried collections yet.

1 ACCEPTED SOLUTION

Accepted Solutions
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Populating Data Table from 3 Tables based on LookUp ( like INNERJOIN )

You can add multiple columns in a single AddColumns call, so you can have something like the expression below:

ShowColumns(
    AddColumns(
        Orders,
        "CustomerName",
            LookUp(Customers, CustomerId = Orders[@CustomerId], CustomerName),
        "SupplierName",
            LookUp(Suppliers, SupplierId = Orders[@SupplierId], SupplierName)),
    "OrderId", "CustomerName", "SupplierName", "OrderDate")

Hope this helps!

2 REPLIES 2
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Populating Data Table from 3 Tables based on LookUp ( like INNERJOIN )

You can add multiple columns in a single AddColumns call, so you can have something like the expression below:

ShowColumns(
    AddColumns(
        Orders,
        "CustomerName",
            LookUp(Customers, CustomerId = Orders[@CustomerId], CustomerName),
        "SupplierName",
            LookUp(Suppliers, SupplierId = Orders[@SupplierId], SupplierName)),
    "OrderId", "CustomerName", "SupplierName", "OrderDate")

Hope this helps!

anubhavkapoor
Level: Powered On

Re: Populating Data Table from 3 Tables based on LookUp ( like INNERJOIN )

That worked like a charm!! 

 

Thank you so much. Now i am starting to pickup the syntax in PowerApps. They are really cool.

 

Will post more questions as I proceed.