cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AnastasiaD
Regular Visitor

Can I assign data to ComboBox SearchText?

I need to put data to ComboBox SearchText property, so that it initially appeared with some text in it. Tried to do this from Screen.OnVisible but nothing happens. No error. Could it be that it overwrites after that with some defaults? Or is it not possible to assign data to ComboBox SearchText apart from typing in?

1 ACCEPTED SOLUTION

Accepted Solutions
AnastasiaD
Regular Visitor

OMG, I think I got it! When the option does not exist I create it with a Table() in a ComboBox.DefaultSelectedItems. I mean I still have no idea why I can't put text to SearchText property but I don't need it. Thank you for inspiration!

View solution in original post

6 REPLIES 6
AnastasiaD
Regular Visitor

OMG, I think I got it! When the option does not exist I create it with a Table() in a ComboBox.DefaultSelectedItems. I mean I still have no idea why I can't put text to SearchText property but I don't need it. Thank you for inspiration!

v-albai-msft
Community Support
Community Support

Hi @AnastasiaD ,

What's the Items property of your combo box?

I did a test on my side, you can refer to my formula.

1. I have a combo box to search users using Office365Users connector, here is the formula I used before:

Office365Users.SearchUser ({searchTerm: combobox1.SearchText})

 2. To set a default search text for this combo box, I change the formula to below, just add a condition to check if its SearchText is blank:

If(IsBlank(combobox1.SearchText), Office365Users.SearchUser ({searchTerm: "allen"}),Office365Users.SearchUser ({searchTerm: combobox1.SearchText}))

Best regards,

Allen

Hello, Allen! 

Items are a filtered set of records from a SharePoint table. It is a part of scenario when user can either fill a new form (using both ComboBox options and ComboBox free entry which is SearchText), or edit a previously entered form - and here is when I need to fill ComboBoxes with its previously entered options or previous free entry. So I have no problem to put the required option to ComboBox.DefaultSelectedItems. But I can't put free entry back to ComboBox. 

Does it make sense? 🙂 

Thank you

AnastasiaD
Regular Visitor

I need it to stay in a ComboBox as a text, not as a clue to items, because if it was previously entered as free text then it means that this search did not bring any items from existing ComboBox options. 

AnastasiaD
Regular Visitor

Have no problems with putting text to Combobox.InputTextPlaceholder, so I might use it as a workaround but it looks weird. 

Hi @AnastasiaD ,

I tried to understand your scenario but failed. I am confused about your requirement now..But from the usage of text in InputTextPlaceholder, I think you just want to have a default text that will not lose even when you re-select another selection(or do other action). If so, seems using InputTextPlaceholder is a good solution(I have tried to use variable but cannot get a satisfied result).

Best regards,

Allen

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,159)