cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dpalmer
Helper III
Helper III

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
wyotim
Resident Rockstar
Resident Rockstar

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*

View solution in original post

1 REPLY 1
wyotim
Resident Rockstar
Resident Rockstar

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*

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,292)