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!

View solution in original post

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!

View solution in original post

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.

 

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 53 members 3,309 guests
Please welcome our newest community members: