cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Neil6
Helper I
Helper I

auto populate combo box

Hello everyone,

 

I am building an app that connects to sql server which is already populated with data. On my edit screen there is a field for Business Unit. Now I changed it to a combo box because I wanted it to auto populate when the user is typing. But i cant seem to make it work. I am having an invalid If statement error in the Update property of the combo box data card.

 

Here is my If statement on the Update property:

If(IsBlank(ComboBox1.Selected.Business_Unit),ComboBox1.SearchText,ComboBox1.Selected.Business_Unit))

 

Could you help me please?

 

Thanks in advance

17 REPLIES 17
v-siky-msft
Community Support
Community Support

Hi @Neil6 ,

 

Try to modify the items property of the combo box to 

'[dbo].[empmaster2]'.Business_Unit

It is no need to be enclosed in the brackets.

 

Hope this helps.

Sik

Hi @Neil6 ,

I use SharePoint, but I just tested this on a Text field with output from a Combo Box (yes I know it is your original code).

If(
    IsBlank(ComboBox1.Selected.Business_Unit),
    ComboBox1.SearchText,
    ComboBox1.Selected.Business_Unit
)

I will leave you with @v-siky-msft as I do not use SQL for Power Apps.

 

 

Hi @v-siky-msft 

 

I tried it and this is the combo box now

 

Neil6_0-1593668423924.png

And when I tested it, i wasn't able to type/search instead it behave like a dropdown.

Hi @WarrenBelz ,

 

Thank you for your time, I really appreciate your help.

 

Best regards

v-siky-msft
Community Support
Community Support

Hi @Neil6 ,

 

That is so weird. How about this? Set the Items property to 

'[dbo].[empmaster2]'

Then set the Primary text and SearchField in Field property to Business_Unit

 

If this still doesn't work, please share the sample data of '[dbo].[empmaster2]', I just want to know what is the Business_Unit

Sik

Hi @v-siky-msft ,

 

It is working now, I can search the combo box and it auto populates based on the given input.

 

Neil6_0-1593670143020.png

 

But one thing is missing, it doesn't show the existing record just like shown below.

Neil6_1-1593670232676.png

 

v-siky-msft
Community Support
Community Support

Hi @Neil6 ,

 

Try to configure the DefaultSelectedItems property of Combobox: 

{Business_Unit: ThisItem.Business_Unit}

Sik

Hi @v-siky-msft ,

 

It is now showing the existing value, but when i tried it, it doesn't save on my database.

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (3,881)