I have searched everywhere for the answer to this requirement and cannot find a match for what must be a common requirement. This would normally be done using a simple SQL SELECT statement, but this is not supported in Flow ☹
I want to do a 1:1 join across two SharePoint lists where the join is the unique column ‘EmployeeEmail’.
I have tried using Get List to load Table1 into an array but have got stuck trying to append the Objectives in Table2 to the end of each row in the array. Do I need one of the Data Operations actions?
The output of this query is going to be fed into the FormsPro Send a Survey action.
Run a Get Items for each list and then try using the Union() function. There is no easy way to do the equivalent of a Join with SharePoint lists. But I've used Union() to do this in the past if there is a Lookup column in the second list that points back to the first.
The challenge is I want to append the output from List2 onto the end of List1 (using 'where list1.email=list2.email' as my join) which is why I was trying arrays. Union just adds the two lists together. This is so easy to do using SQL SELECT but there is no SELECT command in the expression builder. Why not I wonder?
If there is a Lookup column in List 2 based on list1.email then union should do what you want it to.
The reason there is no Select where in Power Automate for SharePoint is that SharePoint isn't a relational database. Its flat tables. Select Where works in SQL because SQL is designed to be relational. SharePoint isn't (other than when you simulate relationships using Lookup columns).
There is indeed a Lookup column. List1 contains all employees and List2 contains their objectives. When creating a new objective you pick the user email from List1 via a lookup.
What is the syntax for the union expression? There doesn’t seem to be anything other than the two lists. Does it magically work out they are joined via the email Lookup column?
In my tests, if you do Union(List1, List2) it will automatically match the records from list 2 based on the lookup column.
Your only other choice would be to build an array of objects manually using two Apply to each loops. The outer loop will go through each entry in List 1 and the inner loop will go through list 2 looking for a matching email. When it finds it the inner loop will write an entry to the array containing the value from List 1 and list 2 that match. Its really manual, but it will work. Just not sure how performant it will be.
This is the Union statement I tested: