Hi
The AllowUnsetValue property of a regular dropdown is absolutely awesome. I found this secret property hidden on this forum and it can be used to set the default selected item in a drop down menu as a blank value when set to "true". Finally an easy solution that actually works! Thank you PowerApps-team!
Unfortunately there is no AllowUnsetValue property for a combobox (with single select in my usecase). Why is that? These are similar controls. Or does this have a different name for comboboxes?
I'm just looking for a way to display a blank value in a combobox when a new record has to be created in a gallery EditScreen while maintaining the default selected item when editting an existing record. But it seems like it's only one way or the other way and both can't go together, unless I would have something like the AllowUnSetValue 😮
My Items property for the single select combobox is:
'Office365-users'.SearchUser({searchTerm: ComboBox1.SearchText}).DisplayName
This gives me a beautiful list of all the employee names from the Office365-connector and the default value is blank which is what I want:
My DefaultSelectedItems property for the combobox is:
'Office365-Users'.SearchUser({searchTerm: Parent.Default}).DisplayName
This is necessary. Without this, the combobox is reset to blank when editting an existing record. The combobox however needs to be the selected item from the ViewForm. Now the behaviour for editting an item becomes correct but the behaviour for creating a new item becomes wrong. When creating a new record, the first employeename in the Office365-list becomes the default where I want this to be blank...
My Default property for the combobox is nothing at all
My Default property for the Gallery card is:
ThisItem.Emloyee
This is where the data is saved in a CDS table, lets say Table1, column Employee
My Update property for the Gallery card is:
ComboBox1.Selected.DisplayName
Question:
If the awesome AllowUnsetValue property doesn't exist for comboboxes, is there any workaround as the behaviour of my form is almost perfect, but actually not because when creating a new record, the first name of the Office365-list of employees is automatically selected
Friendly greets
Solved! Go to Solution.
I found the solution thanks to Carlos:
https://powerapps.microsoft.com/en-us/blog/default-values-for-complex-sharepoint-types/
In the DefaultSelectedItems property from the combobox I had to enrich the formula with: If(EditForm1.Mode=FormMode.Edit;....;Blank()). So the formula needs to be:
If(EditForm1.Mode=FormMode.Edit;'Office365-users'.SearchUser({searchTerm:Parent.Default}).DisplayName;Blank())
Hopefully this is useful for other people searching for this 🙂
I found the solution thanks to Carlos:
https://powerapps.microsoft.com/en-us/blog/default-values-for-complex-sharepoint-types/
In the DefaultSelectedItems property from the combobox I had to enrich the formula with: If(EditForm1.Mode=FormMode.Edit;....;Blank()). So the formula needs to be:
If(EditForm1.Mode=FormMode.Edit;'Office365-users'.SearchUser({searchTerm:Parent.Default}).DisplayName;Blank())
Hopefully this is useful for other people searching for this 🙂
User | Count |
---|---|
157 | |
93 | |
80 | |
74 | |
57 |
User | Count |
---|---|
201 | |
166 | |
98 | |
94 | |
79 |