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

Use a ComboBox with data from another database

Hi there, I'm getting in the powerapps world and I'm trying to create a simple app that manage customer contracts. So the idea is to create a Sharepoint list to hold the contract information and on top of the SharePoint list to apply a PowerApps  that allow my users to add new contracts. Where I'm stuck is in the form creation 'cos I want to create a ComboBox to display the customer names which exist in a SQL database. So I'm not sure how to show the ComboBox inside the edit form so once the user select the customer name and fill all the others fields the info will be saves into the SharePoint list.

 

Thanks for any guidance!

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Use a ComboBox with data from another database

Hi @diegoadum

 

Here's a post I wrote the other week on how to use the ComboBox control on a form.

 

https://powerusers.microsoft.com/t5/Creating-Apps/Drop-Down-Box-Lookup/m-p/82049#M827

 

Once you build a form that's based on your SharePoint list, you would change the control type of your customer card to 'Allowed Values'. This changes the control in your customer card from a text input control to a combo control. You would then set the Items property of your combo control to your SQL table, for example, '[dbo].[tblCustomer]'.

 

The final step is to configure the update property of the customer card to save the combo box value to your SharePoint list, and to configure the default value of the combo box control to show the selected customer when the form loads an existing record. The link above provides some sample code that you can adapt to suit your needs.

 

View solution in original post

4 REPLIES 4
Super User
Super User

Re: Use a ComboBox with data from another database

Hi @diegoadum

 

Here's a post I wrote the other week on how to use the ComboBox control on a form.

 

https://powerusers.microsoft.com/t5/Creating-Apps/Drop-Down-Box-Lookup/m-p/82049#M827

 

Once you build a form that's based on your SharePoint list, you would change the control type of your customer card to 'Allowed Values'. This changes the control in your customer card from a text input control to a combo control. You would then set the Items property of your combo control to your SQL table, for example, '[dbo].[tblCustomer]'.

 

The final step is to configure the update property of the customer card to save the combo box value to your SharePoint list, and to configure the default value of the combo box control to show the selected customer when the form loads an existing record. The link above provides some sample code that you can adapt to suit your needs.

 

View solution in original post

diegoadum
Level: Powered On

Re: Use a ComboBox with data from another database

Thanks for your help and the post. It's very self explanatory and help me a lot. Nevertheless I'm having some hard time trying to figurate out how to handled the step #8 in your post.

 

LookUp(Instructors, ID = Parent.Default).Name

 

In my case CustomerDim instead Instructors, but the issue since to be with the Parent.Default. I got a red line below Default so I'm pretty much sure I'm clicking not the right place to do this.

Super User
Super User

Re: Use a ComboBox with data from another database

Hi @diegoadum

 

I'm assuming that you're using a text column to store your customer name in SharePoint. Therefore, I suspect you're seeing this error because Parent.Default refers to a text column in SharePoint and ID possibly refers to the numeric primary key value in your SQL data. The mismatch in data types would be the cause of this problem.

 

The Lookup function finds the first record in a data source that matches a condition. Let's assume that this is the schema of your SQL table:

 

CustomerDim(ID, Fullname, Address)

The Lookup syntax you would use would look something like this:

 

LookUp('[dbo].[CustomerDim]', Fullname = Parent.Default).Fullname

If you hover your mouse over the red line, the designer should give you a more precise description of the error.

Highlighted
defdames
Level: Powered On

Re: Use a ComboBox with data from another database

I was able to get this to work but the problem I am having is with a multiple select it will only upadte the last value

 

i.e. in the combox the values are A, B but when I submit the form to the sharepoint list only B is being submitted.  Any help is greatly appreciated.

 

 

 

Damien

Helpful resources

Announcements
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 146 members 5,489 guests
Please welcome our newest community members: