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

save data to database from different form

how to save data to sql server from different forms?

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Community Support Team
Community Support Team

Re: save data to database from different form

Hi @neethup ,

Do you want to update one record by using two forms?

Could you tell me the fields' data type that you want to update ?

I've made a simlar test for your reference:

Screen1:

2 fields in form1(Title:Title_DataCard1, amount:amount_DataCard3)

one button's OnSelect: Navigate(Screen1,None)

Screen2:

2 fields in form2(priceSmiley Tonguerice_DataCard3, testdate:testdate_DataCard3)

One submit button's OnSelect:

Patch(fruit,Defaults(fruit),
{Title:Title_DataCard1.Update,amount:amount_DataCard3.Update,
priceSmiley Tonguerice_DataCard3.Update,testdate:testdate_DataCard3.Update
}
)

And then ,the data in two forms will update to the same record of the same table.6137.png

6138.png

To sum up, use the patch fucntion insted of submitform funtion. Use the datacard's update property to repersent every field's data.

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
neethup
Level: Powered On

Re: save data to database from different form

@v-yutliu-msft yea drop down controls are inside the form.. for ecah drop down i have set to different datasource in items property

11 REPLIES 11
Super User
Super User

Re: save data to database from different form

Hi @neethup 

In general, each Edit form can only save data to one table.  The table must be imported into PowerApps as a datasource.   The form can be opened using either NewForm() or EditForm().  The form requires a datasource (your sql table) and if it is for entering data only, there is no need to specify the Item property.  If it is for editing an existing record, the Item property of the form must identify the record that has been selected to edit. 

neethup
Level: Powered On

Re: save data to database from different form

@Drrickryp i have two forms for entering data , one form contains some fields and another one some drop downs so i hve multiple data sources and in second form i have one save button.. i want to save both form values into sql server.. how to do that?

 

Community Support Team
Community Support Team

Re: save data to database from different form

Hi @neethup ,

Could you describe more clearly about your demands? Or show me the screenshoots.

According to your description, there are many possibilities. So I'm a little confused.

1)save two forms to the same record of the same table

2)save two forms to different records of the same table

3)save two forms to different tables

Which one do you really want to?

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
neethup
Level: Powered On

Re: save data to database from different form

i have two forms on two screens first form contains some fields to insert data and the second one with some drop downs, the problem is i have to save these two form values into one table(sql)

Community Support Team
Community Support Team

Re: save data to database from different form

Hi @neethup ,

Do you want to update one record by using two forms?

Could you tell me the fields' data type that you want to update ?

I've made a simlar test for your reference:

Screen1:

2 fields in form1(Title:Title_DataCard1, amount:amount_DataCard3)

one button's OnSelect: Navigate(Screen1,None)

Screen2:

2 fields in form2(priceSmiley Tonguerice_DataCard3, testdate:testdate_DataCard3)

One submit button's OnSelect:

Patch(fruit,Defaults(fruit),
{Title:Title_DataCard1.Update,amount:amount_DataCard3.Update,
priceSmiley Tonguerice_DataCard3.Update,testdate:testdate_DataCard3.Update
}
)

And then ,the data in two forms will update to the same record of the same table.6137.png

6138.png

To sum up, use the patch fucntion insted of submitform funtion. Use the datacard's update property to repersent every field's data.

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
neethup
Level: Powered On

Re: save data to database from different form

@v-yutliu-msft  hi.. this s my formsform1.pngform2.png

Community Support Team
Community Support Team

Re: save data to database from different form

Hi @neethup ,

As long as the fields are inside form, you could use its datacard's Update to represent its data.

So try the formula:

Patch(tablename,Defaults(tablename),{field1:datacard1.Update,field2:datacard2.Update,field3:datacard3.Update,....})

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
neethup
Level: Powered On

Re: save data to database from different form

@v-yutliu-msft hi.. i have tried patch its working fine but dropdown values are not updated to database

Community Support Team
Community Support Team

Re: save data to database from different form

Hi @neethup ,

Could you tell me 

1)are these drop down controls inside a form?

2) how do you set these drop down's Items?

3)what are the fields' data type that the drop down binging with?

 

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

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

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

Users Online
Currently online: 179 members 5,348 guests
Please welcome our newest community members: