简体   繁体   中英

Joining 2 SharePoints list in Power Automate

I am wondering if anyone has a solution for this issue that I am facing. I have finished building a repeating table solution involving 2 SharePoint lists.

List A - This is the main list where the form is hosted to do all the data entry.

List B - This is the list that handles repeating data. It has a column named Base_ID that contain the matching ID from List A (there could be 10 items in List B that goes with 1 item in List A).

What I am looking to do is, create a flow that will get all the data from both lists and do (what you would do in MySQL) is a left join.

Now I did find https://powerusers.microsoft.com/t5/Using-Flows/Merging-two-datasets-in-Power-Automate/td-p/944323 and https://powerusers.microsoft.com/t5/Building-Flows/Join-Two-Datasets-in-Flow/td-p/354458 and I have seen comments regarding performance.

Does anyone here know if there is a faster way to do all of this?

You may want to explain the need to have the data all in one list.

This looks like a parent/child relationship, with multiple records in list B relating to one item in list A. I would just leave this alone.

If you want to build forms with this data, that is no problem with PowerApps. You can build screens that show the parent item and a table of all related items by filtering list B with the ID from the List A item. You can add/remove/edit items from List B in PowerApps easily.

If you want to run reports on the data with Excel and Power BI, pull the two list as separate queries and do a merge (ie join) in the Query editor.

That way you can keep the data normalized and avoid duplication of values.

Edit after comment : To join the data from the two lists, so you can compose an email notification, you can use the following approach:

Use Get Items from list A that require processing
for each item in the list (Outer loop)
   Get items from list B where the ID matches the A item ID
   for each item returned from list B (inner loop)
       write item details into a collection
   next item from list B (end inner loop)
   send notification with item details
next item from list A (end outer loop)

This kind of processing is not hard to do and unless you have thousands of records it will not take too long to process.

You can accomplish this by creating a flow in Microsoft Power Automate that retrieves the data from both lists and then performs a join operation on the data.

Here's an example of how you can set up the flow:

Use the "Get items" action to retrieve all the items from List A and List B. Use the "Join" action to join the two lists based on the "Base_ID" column. The "Join" action will output a new array that contains all the items from List A along with the matching items from List B. Use the "Create item" action to add the joined items to a new list, or use the "Update item" action to update the items in List A with the data from List B. You can also use the "Apply to each" action to loop through the joined items and perform additional actions on each item.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM