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

1 ACCEPTED SOLUTION

Accepted Solutions
v-siky-msft
Community Support
Community Support

Hi @Neil6 ,

 

Try to configure the DefaultSelectedItems property of Combobox: 

{Business_Unit: ThisItem.Business_Unit}

Sik

View solution in original post

17 REPLIES 17
WarrenBelz
Super User
Super User

Hi @Neil6 ,

You have an extra closing bracket for a start. Happy to help further if this does not solve it.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi @WarrenBelz ,

 

Thank you for the quick reply. I did what you told, I took off that extra closing bracket but still having an error.

"The name isn't valid. The identifier isn't recognized".

 

Hi @Neil6 ,

I am assuming you are writing back to a Choice field? Try this

If(
   IsBlank(ComboBox1.Business_Unit),
   {Value: ComboBox1.SearchText},
   ComboBox1.Selected
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi @WarrenBelz 

 

I tried the script and a new error came out "Expected Text Value". I'm not sure if I understand your question correctly, but, the idea is whenever the user types it should search the Business_Unit field for matches. If none, then the new input will be saved, if existed then the user can select and save as well.

v-siky-msft
Community Support
Community Support

Hi @Neil6 ,

 

What is the data type of Business_Unit field? What is Items property of Combo box?

please share the snapshot of where the red wave is displayed when using this code?

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

 

It seems that the error is due to the ComboBox1.Selected.Business_Unit code, the column name after the ComboBox1.Selected must be from the Items property of combo box.

You can first to input the 'ComboBox1.Selected.' and then try the suggested column name in the dropdown.

Snipaste_2020-07-02_11-29-46.png

If this doesn't make sense, please share more details.

Hope this helps.

Sik

BTW, I really appreciate giving your time in solving my problem. Actually, this is my first app and I'm still trying to familiarize myself on using powerapps.

Hi @Neil6 ,

As requested, I need the type of field of Business_Unit - I has assuming Choice, but is it plain Text?

Hi @v-siky-msft 

 

The Business_Unit field is varchar data type.

 

Here is the items property of the combo box.

 

Neil6_0-1593667383680.png

 

And here is where the code gets an error

Neil6_1-1593667438326.png

 

"You can first to input the 'ComboBox1.Selected.' and then try the suggested column name in the dropdown."

 

I tried it before but still got an error

Hi @WarrenBelz ,

 

The Business_Unit field is varchar data type and yes it is just plain text.

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,637)