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

Update data from Collection into SQL Server

Hello,

I'm using a Collection to store data locally in mobile phone. What I do is I pull this data to a collection, make changes and want to send back to the SQL Server.

 

I'm using ForAll but this is not working. The collection name is 'clcDadosOffline'. The code is below:

  ForAll(clcDadosOffLine;
  Patch ('[dbo].[TropicalChamber]'; First(Filter('[dbo].[TropicalChamber]';identification=clcDadosOffLine.identification));{Week1_Carnal:    31; Week1_Flor: 41}))

 

What I'd like is: Get each line of the Collection, looking at the SQL Server (The field is 'identification'). Once I find this row, I'd update with new values.

 

Does anyone has a clue on how to make this work?

Thanks.

Paulo Zampieri

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Update data from Collection into SQL Server

Hi Paulo,

Assuming that both '[dbo].[TropicalChamber]' and clcDadosOffLine contain a field called identification, the error might be due to incorrect disambiguation syntax.

I would try the following to see if that makes any difference.

 ForAll(clcDadosOffLine;
        Patch ('[dbo].[TropicalChamber]'; 
First(Filter('[dbo].[TropicalChamber]';identification=clcDadosOffLine[@identification]));
{Week1_Carnal: 31; Week1_Flor: 41}
)
)

 

View solution in original post

4 REPLIES 4
Super User
Super User

Re: Update data from Collection into SQL Server

Hi Paulo,

Assuming that both '[dbo].[TropicalChamber]' and clcDadosOffLine contain a field called identification, the error might be due to incorrect disambiguation syntax.

I would try the following to see if that makes any difference.

 ForAll(clcDadosOffLine;
        Patch ('[dbo].[TropicalChamber]'; 
First(Filter('[dbo].[TropicalChamber]';identification=clcDadosOffLine[@identification]));
{Week1_Carnal: 31; Week1_Flor: 41}
)
)

 

View solution in original post

Highlighted
plzampieri
Level: Powered On

Re: Update data from Collection into SQL Server

Hello, Timl

 

That worked pretty well.

 

thank you so much.

Paulo.

leonardodcbv
Level: Powered On

Re: Update data from Collection into SQL Server

Does this solution really works? I used the same formula and works with a Collection, but it does NOT work with a SQL Server table.

 

patch.png

 

Someone has a clue about how to make it work?

leonardodcbv
Level: Powered On

Re: Update data from Collection into SQL Server

Forget it. I solved it adding a Primary key constraint to my SQL Server Table source.

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,011)