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

Use custom inputs to write data to sql table

I am working to create an app that utilizes only manual inputs, meaning all of the controls will be textbox, dropdowns radio buttons etc, and I want to be able to take and write that data to multiple SQL tables. Can anyone advise on how to do this? I am familiar with creating apps based on existing data and using edit forms. How can I create a similar process to write this data?

 

Some examples

Job Status - Active, Closed, Inprogress

Job Number - AB-00001 (all jobs need to start with AB, ideally automatically)

Client Name 

etc.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Use custom inputs to write data to sql table

Hi @accorti ,

Do you want to use multiple controls to update rather then using a form?

Well, if so, you just need to use Patch function.

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

I assume that all of them are char type.

I've made a similar test for your reference:

1)insert a drop down, two textinputs

set the drop down's Items: 

["Active", "Closed", "Inprogress"]

set the textinput1's Default: 

"AB-"

2)set the update button's OnSelect:

If(StartsWith(Textinput1.Text,"AB-"),
   Patch(table,Defaults(table),
               {Job Status:drop down1.Selected.Value,Job Number :Textinput1.Text,Client Name :Textinput2.Text}
         ),
Notify("Job Number should starts with "AB-"",NotificationType.Warning)
  )

Please note that your sql table should have primary key, or else you can not update it in PowerApps.

 

 

 

Best regards,

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.

View solution in original post

2 REPLIES 2
Community Support Team
Community Support Team

Re: Use custom inputs to write data to sql table

Hi @accorti ,

Do you want to use multiple controls to update rather then using a form?

Well, if so, you just need to use Patch function.

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

I assume that all of them are char type.

I've made a similar test for your reference:

1)insert a drop down, two textinputs

set the drop down's Items: 

["Active", "Closed", "Inprogress"]

set the textinput1's Default: 

"AB-"

2)set the update button's OnSelect:

If(StartsWith(Textinput1.Text,"AB-"),
   Patch(table,Defaults(table),
               {Job Status:drop down1.Selected.Value,Job Number :Textinput1.Text,Client Name :Textinput2.Text}
         ),
Notify("Job Number should starts with "AB-"",NotificationType.Warning)
  )

Please note that your sql table should have primary key, or else you can not update it in PowerApps.

 

 

 

Best regards,

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.

View solution in original post

accorti
Level: Powered On

Re: Use custom inputs to write data to sql table

@v-yutliu-msft  Thank you for your response! I am not opposed to using a form and I think I will look into just using the SQL table architecture to create a form for populating those tables. 

 

 

 

The solution you provided also sounds like the right outcome I am looking for. Can you elaborate a bit more on the use of the patch function? I need to write data to an Azure SQL db. Within the patch function, I assume I would specify the server name in the first argument, but how would I authenticate within that function?

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,814)