cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dave5
Level: Powered On

Comparing SQL List to SPO List, then writing Unique SQL items into SPO.

Hello! 

 

   I'm having a bit of an issue comparing what I believe to be 2 different arrays. I'm pulling from a SQL Database 5-10 rows and comparing one columns values to the list of items already in a SPO list. If that column isn't found in the SPO list, then I need to write that SQL Rows data to the SPO list. The item I am comparing (KeyID) is unique and not duplicated anywhere. A couple of questions about this:

 

1. After a lot of trial and error and looking through tons of posts, I think I've found out I need to pass the KeyID column of SQL and SPO into their own array variables then compare them. Is that the best way?

 

2. If it is, I've successfully passed the KeyID Column from SQL to a variable and into Sharepoint. I've had the damnedest time making an IF statement to determine if the KeyID pulled from SQL is already in SPO. My logic is below. I feel like contain is the wrong comparison to use and that I may not be comparing individual elements in the Array Variable to the individual elements in the other Array. Any help is welcome!2019-05-01_13-02-34.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
v-zhos-msft
Level 10

Re: Comparing SQL List to SPO List, then writing Unique SQL items into SPO.

Hi @Dave5 ,

It seems you want to check whether the KeyID Column value from SQL in the SharePoint list.

If no, insert the row into the list.

I have made a flow for your scenario, please check it for a reference.

In my flow, I check if the ID value from SQL in the list 'ID' column.

Here I set an array variable to append all the value from the list 'ID' column.

Then use the contains function to check the each item from SQL.

Capture7.PNGCapture9.PNG

Best Regards,

Community Support Team _ Zhongys

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

2 REPLIES 2
Highlighted
v-zhos-msft
Level 10

Re: Comparing SQL List to SPO List, then writing Unique SQL items into SPO.

Hi @Dave5 ,

It seems you want to check whether the KeyID Column value from SQL in the SharePoint list.

If no, insert the row into the list.

I have made a flow for your scenario, please check it for a reference.

In my flow, I check if the ID value from SQL in the list 'ID' column.

Here I set an array variable to append all the value from the list 'ID' column.

Then use the contains function to check the each item from SQL.

Capture7.PNGCapture9.PNG

Best Regards,

Community Support Team _ Zhongys

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

Dave5
Level: Powered On

Re: Comparing SQL List to SPO List, then writing Unique SQL items into SPO.

You're amazing! Thank you. I couldn't wrap my head around this. It works like a charm. 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 296 members 4,735 guests
Please welcome our newest community members: