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

Setting DefaultSelectedItems of ComboBox to work like Dropdown

Hello,

 

I have a (functioning) PowerApps form pointing to SQL Server.  One of the fields is a dropdown box where, if it is a new records, displays "...Select a value" and, if modifying a record, shows the currently saved record.  This works fine:

 

DEFAULT: If(EditForm_InvestmentChecklist.Mode=New, "...Select a value", ThisItem.LGL_InvestmentChecklist_InvestmentName)

 

But, the users want to be able to search/filter the dropdown results so it appears I need to use a combobox.  The DEFAULT calc above does not work in the combobox.  Have also tried moving this to DEFAULTSELECTEDITEMS and that doesn't work either.  I have 'Allow Multiple Selections' = False.  Can only have 1 value selected.

Any assistance appreciated.

Thanks,

Dan

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Champion
Community Champion

Re: Setting DefaultSelectedItems of ComboBox to work like Dropdown

Hi @lesotho_kid ,

Try this in the DefaultSelectedItems

{Value:ThisItem.LGL_InvestmentChecklist_InvestmentName}

or

{LGL_InvestmentChecklist_InvestmentName:ThisItem.LGL_InvestmentChecklist_InvestmentName}

 

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.

View solution in original post

3 REPLIES 3
Highlighted
Community Champion
Community Champion

Re: Setting DefaultSelectedItems of ComboBox to work like Dropdown

Hi @lesotho_kid ,

Try this in the DefaultSelectedItems

{Value:ThisItem.LGL_InvestmentChecklist_InvestmentName}

or

{LGL_InvestmentChecklist_InvestmentName:ThisItem.LGL_InvestmentChecklist_InvestmentName}

 

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.

View solution in original post

Highlighted
Community Support
Community Support

Re: Setting DefaultSelectedItems of ComboBox to work like Dropdown

Hi @lesotho_kid ,

 

What is the Items property of combobox?

 

The DEFAULTSELECTEDITEMS  property should be a record retrieved from the combobox Items, so try with LookUp function.

For example, If the combobox items property is Accounts, and want Tom to be the Default selection, the DEFAULTSELECTEDITEMS property should be like this:

LookUp(Accounts, 'Account Name'="Tom")

So in your case, the code synatx:

If(
EditForm_InvestmentChecklist.Mode=FormMode.New,
LookUp(ItemsProperty,'The Column' = "...Select a value"),
LookUp(ItemsProperty,'The Column' = ThisItem.LGL_InvestmentChecklist_InvestmentName)
)

Hope this helps.

Sik

Highlighted
Helper I
Helper I

Re: Setting DefaultSelectedItems of ComboBox to work like Dropdown

Thanks @WarrenBelz 

That worked - just had to add the if statement.  And need to review how/why the curly brackets were needed.   Is there a special term to read about - some sort of array or something like that?  Assuming it is related to the multiple item option.

 

This was the final answer:

If(EditForm_InvestmentChecklist.Mode=New,{Value:"...Select a value"}, {Value:ThisItem.LGL_InvestmentChecklist_InvestmentName})

 

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (9,040)