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

Get Data from a SQL database and save on another SQL database

Hi guys.

 

I'm new on the PoweAapps (not to say noob) and am having trouble getting what I need.

 

Here's the point:

 

I have two different databases (database A ;; database B), with different columns (a1, a2, a3 ;; b1, b2, b3).

I need my app to get the information from database A, column a1 and save this information to database B, column b1.

 

I already have both databases connected through the gateway.

 

I was able to select information from database A, column a1 through the ComboBox. Now I need the selected information to be saved to database B, column b1

 

I don't know if I was clear, but if you can help me I was very grateful!

 

Translated by GoogleTranslate PT_BR > EN

1 ACCEPTED SOLUTION

Accepted Solutions
v-siky-msft
Level 8

Re: Get Data from a SQL database and save on another SQL database

Hi @viniandrade ,

 

There are several functions you can use to save data, such as Patch(), Collect(), Update(), etc.

To create new records, you can refer to the following formulas:

Patch('Database B', Defaults('Database B'), {b1: Combobox.Selected.a1})
Collect('Database B',  {b1: Combobox.Selected.a1})

To modify records, you can refer to the following formulas:

Patch('Database B', BaseRecord, {b1: Combobox.Selected.a1})
Update('Database B', OldRecord, {b1: Combobox.Selected.a1})   /* this will replace the record, not modify values*/

Best regards,

Sik

3 REPLIES 3
Super User
Super User

Re: Get Data from a SQL database and save on another SQL database

Here is an example of how you could use a button to patch the data to database b.

 

Patch('Database B', Defaults('Database B'), {b1:Combobox.Selected.Value})

 

*You'll need to update names to reflect what is being used in your app

*This creates a new record in Database B



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
v-siky-msft
Level 8

Re: Get Data from a SQL database and save on another SQL database

Hi @viniandrade ,

 

There are several functions you can use to save data, such as Patch(), Collect(), Update(), etc.

To create new records, you can refer to the following formulas:

Patch('Database B', Defaults('Database B'), {b1: Combobox.Selected.a1})
Collect('Database B',  {b1: Combobox.Selected.a1})

To modify records, you can refer to the following formulas:

Patch('Database B', BaseRecord, {b1: Combobox.Selected.a1})
Update('Database B', OldRecord, {b1: Combobox.Selected.a1})   /* this will replace the record, not modify values*/

Best regards,

Sik

viniandrade
Level: Powered On

Re: Get Data from a SQL database and save on another SQL database

Tankyou guys.

 

This realy helps me and the data was submited to my other SQL Database.

 

Realy Thanks!!!

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

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