web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Left/Outer Join Equiva...
Power Apps
Unanswered

Left/Outer Join Equivalent

(0) ShareShare
ReportReport
Posted on by 2,129

Content migrated from TechNet.  Post attribution to:Nam H

I understand the basic principle of "Filter" and "Lookup", but what is the syntax to join two tables to create a dataset?  Can left/outer joins be used as the data source?

Categories:
  • Migrated_User Profile Picture
    2,129 on at

    Anyone?  If not, would the "SQL Azure" option bring over Views?  Or is the only bet to wait for the PowerApps team to make RestAPI an option as a Data Source?

  • Migrated_User Profile Picture
    2,129 on at

    You can perform a join of two collections (tables) by using a Collect with AddColumn calls to add the columns from a related table. Here's an example:

    Create a button, add the following to its OnSelect property to create the first collection:

    ClearCollect(orders,
     { id: 1, date: Date(2016, 2, 9), customer: "John Doe" },
     { id: 2, date: Date(2016, 2, 15), customer: "Jane Roe" },
     { id: 3, date: Date(2016, 2, 22), customer: "Jean Poe" })

    Next, create the second "table" by adding a new button with the OnSelect property set to the following expression:

    ClearCollect(orderItems,
     { id: 1, orderId: 1, name: "Bread", quantity: 1 },
     { id: 2, orderId: 1, name: "Milk", quantity: 1 },
     { id: 3, orderId: 2, name: "Cheese", quantity: 1.25 },
     { id: 4, orderId: 2, name: "Ham", quantity: 1.5 },
     { id: 5, orderId: 2, name: "Bread", quantity: 1 },
     { id: 6, orderId: 3, name: "Soda", quantity: 1 },
     { id: 7, orderId: 3, name: "Salad", quantity: 1 })

    At this point you'll have two collections (tables), in a 1:N relationship. To denormalize this relationship into a separate collection, you can collect all items from the 'N' side of the relationship, and add more columns from the '1' side, like with the expression below:

    Collect(merged, AddColumns(orderItems,
     "orderCustomer", LookUp(orders, id = orderId).customer,
     "orderDate", LookUp(orders, id = orderId).date))

    Now, before denormalizing the table, you can also consider splitting the visualization of the data into multiple parts. For this example, in the main screen you'd display all the orders (in a gallery), and if the user selects it, you'd navigate to a separate screen, where you can filter the orderItems collection (e.g., by the Gallery1.Selected.id) to only show the rows (items) from the selected order.


    Carlos Figueira

  • Migrated_User Profile Picture
    2,129 on at

    Can this method it be done directly using tables, or do they have to be collections?

  • Tow1994 Profile Picture
    46 on at

    Think about what Outer/Left-Join does and on what fields you want to join. Then try "in" and "!" in combination 😉

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 381 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 340

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard