cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
anubhavkapoor
Frequent Visitor

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
CarlosFigueira
Power Apps
Power Apps

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
CarlosFigueira
Power Apps
Power Apps

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

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (47,549)