cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate I
Advocate I

Add new items to sharepoint list from sql

So I have seen similar posts trying to do what I am describing but I can't quite get it to work.

 

In summary:

1. I have a sql table which contains items that periodically gets added to it.

2. I have a sharepoint list which contains items that I keep sync with the sql table from 1. (That is, I copy items and remove items from the SharePoint list as they appear and disappear from the sql table)

3. I want to get rows from the sql table, get items from sharepoint list, check if an item exist, do nothing. If it doesn't exist, add to the sharepoint list

 

Both lists have keys that are used to make each item unique. This key key_P&LGroup

 

Here is an idea I am pursuing based on the summary

 

Capture.PNG

 

 

For some reason I can't get this to work....What I am doing wrong?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Add new items to sharepoint list from sql

Hi @mykelboachie ,

 

Please refer to screenshot below to create the flow:

1.png

 

The expression for the first value in the Condition as below:

length(body('Filter_array'))

 

Best regards,

Alice       

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Highlighted
Microsoft
Microsoft

Re: Add new items to sharepoint list from sql

@mykelboachie 

 

I think you can use a filter array action instead of append to array.

 

fourms sql.JPG

 

In the value from you can pass the value form SQL GET ROWS this will be our main array.

Now in the below you can compare it with Value coming from SHARE POINT GET ROWS.

 

On the LHS side of the condition select Share point and on the RHS side select output that you want to compare from SQL.

Once you have this value you can pass the Output of this to an APPLY TO EACH loop and you can put just create item action inside that.

 

It will create an item for all the actions that satisfied the condition.

 

If this information helps you, please hit the like button and mark the solution as resolved, so that it will help other users in future.

Highlighted
Advocate I
Advocate I

Re: Add new items to sharepoint list from sql

Thanks @Krishna92  

 

I setup something similar to what you propose here and here's what I got 

 

Capture1.PNG

 

I can't compare the sharepoint and the sql without running into an apply to each.....So thats 1 and the body at Apply to each 2 contains only the matches of the keys which is, only items that exist in the sharepoint since Apply to Each is bringing items that match on both sides.

 

What I was hoping to get was items that exist in sql table but not in the sharepoint get added...I used the variable just a test to check how many items would be created if my logic works

 

 

Highlighted
Community Support
Community Support

Re: Add new items to sharepoint list from sql

Hi @mykelboachie ,

 

Please refer to screenshot below to create the flow:

1.png

 

The expression for the first value in the Condition as below:

length(body('Filter_array'))

 

Best regards,

Alice       

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

Top Solution Authors
Users online (8,954)