web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / PowerApps and Power Au...
Power Apps
Unanswered

PowerApps and Power Automate integration to sync data back to SQL Server on-prem - performance challenge

(0) ShareShare
ReportReport
Posted on by 9

Hi Community,

I've had a performance issue challenge to tackle over a year ago, and I was scratching my head to find a way to solve it.

The requirement is quite simple: Sync data saved locally through SaveData() function back to a SQL Server on-prem using Data Gateway. Initially, the developer used a direct connection Patching data to SQL Server. It was a nightmare merging data from a Collection to SQL Server. Choosing client-side merging for that scenario wasn't working at all, it was taking over 0.5h to 4h to sync. 

I thought server-side merging would be best and integrating PowerApps with Power Automate could potentially resolve this issue.


I simply created an XML (or you can create a JSON) because I could not use JSON in that version of SQL Server.

 

I set a global variable with the result of XML text to use later as a parameter:

 

Set(
   gloXMLParemeter,

   Concat(
      colCollection,

      Concatenate(

         "<note ", 

         "' to='", colCollection[@to],
         "' from='", colCollection[@from],
         " ></note>"
      )
    )
);
 
Then I created a flow in Power Automate to run a SQL Server stored procedure and process that XML.

 

Ilson_Biscuola_0-1625444276015.png

 

I run the above flow from PowerApps and get all the ids back from SQL Server once the Response in the flow gives me all ids back.

 

Clear(colSQLServerIds, 'Flow'.Run("<ROOT>" & gloXMLParemeter & "</ROOT>"));

 

Well, the result was excellent. Flow runs in 1ms or less and the whole process of sending data back to SQL Server on-prem and updating all collections with the ids I get back from Power Automate flow takes less than 5 seconds. I guess in my case, server-side data merge was a choice.

 

Contat and Contatenate function documentation:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-concatenate#:~:text=The%20Concat%20function%20concatenates%20the,are%20available%20within%20the%20formula.

 

Run a flow from PowerApps documentation:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/using-logic-flows

 

Develop offline-capable canvas apps:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/offline-apps

 

Kind regards,

Ilson Biscuola

 

Categories:
I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard