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

Allow ComboBox Fill-In Values

Hi,

I have a few combo boxes in my app.  App back end is Azure SQL. The combo boxes are connected to tables in the database as the source of the items that can be chosen. Is it possible to have the database item list as a source and also allow fill in values for the combo box?

I've seen some things here in the forums where a solution might be to have a list value of "Other" and when chosen, allow input in a text box for the non-list item.  That's a work around but I think its really messy, and it takes up too much real estate on the screen.

 

Any thoughts?

Thanks,

David

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Allow ComboBox Fill-In Values

I just happen to be working on a project with similar goals and have a suggestion for a solution. You could check agains the search text of the combo box to see if what the user has typed exists in your SQL table. If it does not exist, have an "Add item" button become visible. 

 

Here is what I worked out for the search text check, which would go in the Visible section of the "Add item: button:

 

// Returns true if the search text is not blank and does not match any item in the Name field
IsBlank(
    LookUp(
        '[dbo].[MyTable]',
        Name = cmbMyComboBox.SearchText
    )
) && !IsBlank(cmbMyComboBox.SearchText)

You could then use a Patch statement on the "Add item" button to put the text (cmbMyComboBox.SearchText) in the SQL table. 

 

I do see some possible issues with this as things like typos or misformatted text ("this thing" versus "this-thing", etc.) could result in duplicates that are slightly off. But it would make it easier and cleaner from a UI perspective. Let me know what you think!

 

*edit for leaving some of my actual values in the example code*

1 REPLY 1
Super User
Super User

Re: Allow ComboBox Fill-In Values

I just happen to be working on a project with similar goals and have a suggestion for a solution. You could check agains the search text of the combo box to see if what the user has typed exists in your SQL table. If it does not exist, have an "Add item" button become visible. 

 

Here is what I worked out for the search text check, which would go in the Visible section of the "Add item: button:

 

// Returns true if the search text is not blank and does not match any item in the Name field
IsBlank(
    LookUp(
        '[dbo].[MyTable]',
        Name = cmbMyComboBox.SearchText
    )
) && !IsBlank(cmbMyComboBox.SearchText)

You could then use a Patch statement on the "Add item" button to put the text (cmbMyComboBox.SearchText) in the SQL table. 

 

I do see some possible issues with this as things like typos or misformatted text ("this thing" versus "this-thing", etc.) could result in duplicates that are slightly off. But it would make it easier and cleaner from a UI perspective. Let me know what you think!

 

*edit for leaving some of my actual values in the example code*

Helpful resources

Announcements
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

Users Online
Currently online: 46 members 4,981 guests
Please welcome our newest community members: