Hello all,
I am having issues creating a flow. Let me explain. I have a MYSQL table with information on cleaning activities linked to a property management system. I have a Sharepoint list that has columns for some of the information from each cleaning activity as well as fields to assign the clean to a user and a Yes/No field for clean complete. I am linking the SharePoint list to a PowerApp.
The flow I have designed pulls the information from the Database with Get Tables then Get Rows. It then pulls information from the SharePoint list with Get Items. I want to then compare the Activity number in the table with the Activity number in the SP list. A condition then gives a result based on that comparison. If they match I would like the record in the SP list to be updated. If there is no corresponding Activity number in the SharePoint list I would like the record to be created.
When I try to make this flow a second Apply To Each appears automatically. When I run the flow it seems to compare each Activity number in excess of ten times each and I end up with way too many records. I think I am making an error in the comparison but I am unsure how to resolve it.
Any help would be appreciated
Solved! Go to Solution.
Maybe try doing it this way: for each record from SQL do a call to SharePoint (so put "Get items" in the first for each), but define odata filter: activity_id eq 'sql_activity_id', where acitivity_id is internal name of the column in SP and replace sql_activity_id with dynamic outcome from get rows.
Then check, if number of returned rows is higher than 0.
If yes, do another for each (on data from SP) and update ich record. If not, create record in SP.
Regards,
Tomasz
Hi!
So basically what you want to achieve is to update every SharePoint item that has activity_id matching any record from SQL and for those records in SQL that don't have corresponding entries in SharePoint, create entries in SP?
Regards,
Tomasz
Maybe try doing it this way: for each record from SQL do a call to SharePoint (so put "Get items" in the first for each), but define odata filter: activity_id eq 'sql_activity_id', where acitivity_id is internal name of the column in SP and replace sql_activity_id with dynamic outcome from get rows.
Then check, if number of returned rows is higher than 0.
If yes, do another for each (on data from SP) and update ich record. If not, create record in SP.
Regards,
Tomasz
Hi Tomasz,
Yes, that is exactly what I want to do but I don't know how to leave the "create sharepoint item" until the particular MYSQL record has been checked against every SP item. The way I make the flow creates a SP record every time there isn't a match rather than if there is no match overall.
Any help would be great.
That makes so much sense. How do I check the number of returned rows? I tried with length( ) but my syntax was wrong.
I feel like I am a step closer but not quite there yet.
Exactly! You're almost there. Now build condition, to check if number of rows matching that activity_id in SharePoint is greater than 0. If yes - update them all. If not - create new one:
Inside the condition use the below expression:
That odata query should work. I mean - it's syntax is correct. Just be sure that SharePoint activityID column's internal name is the one you used. But I guess you did that already 🙂
Check out new user group experience and if you are a leader please create your group
See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.
User | Count |
---|---|
25 | |
12 | |
12 | |
7 | |
5 |
User | Count |
---|---|
46 | |
22 | |
16 | |
15 | |
10 |