@MechEng2013
You mention about "default selection" of a ComboBox and that it only works when you manually select from the ComboBox, but not if you leave the "default selection" alone. So that means you sometimes want to use the "default selection" from the ComboBox, is that right?
Your issue here seems similar to something mentioned by @v-xida-msft in this thread:
ComboBox default selected items from a collection doesn't work
I think you have some misunderstanding with the DefaultSelectedItems property of the ComboBox control.
The DefaultSelectedItems property of the ComboBox control is used to set a Default value within the ComboBox control. But the Default value just be displayed within the ComBoBox, rather than select corresponding values from the ComboBox available options and display it.
In other words, the Default value just be used as a Display value within the ComboBox, which would not be recognized that you selected corresponding values from the ComboBox available options.
So you said as follows:
@MechEng2013 wrote:
By "Not Working", I mean that the variable is showing as either BLANK, or just empty string.
If that is the case that it shows Blank or empty string, why don't you try this: check if it is an empty string, if so, then use DefaultSelectedItems instead of SelectedItems - something like the following (the below is not tested, you should adjust the below to make sense for you if needed):
//pseudocode
With
(
{cbsi:cb_CIauditor.SelectedItems,cbsd:cb_CIauditor.DefaultSelectedItems},
,If
(
IsBlank(cbsi)
,Set(varCIauditor, Concat(cbsd, Email, "; "))
,Set(varCIauditor, Concat(cbsi, Email, "; "))
);
)
In the version above, Set is repeated twice, which may not be the best.
It may be better to put the If inside the Set, or actually, even to put the If inside the Concat for that matter, to avoid repetition of the same things twice so the version below is probably better than the version above (the below is also not tested, you should adjust the below to make sense for you if needed):
//pseudocode
With
(
{cbsi:cb_CIauditor.SelectedItems,cbsd:cb_CIauditor.DefaultSelectedItems},
,Set
(
varCIauditor
,Concat
(
If(IsBlank(cbsi),cbsd,cbsi)
,Email
, "; "
)
);
)​
One thing you may wonder is, if it's an empty string, or it's "BLANK" - is that really the same thing? Why do I just use IsBlank function, and not also check specifically for an empty string "" as well just in case?
Well, @v-xida-msft also happened to mention in this thread: IsBlank(), IsEmpty(), or = " " ? that:
the "" (empty string) is not equal to Blank
I remember it worked like that too, and that may have been true at the time of that thread in 2018, but it seems to be no longer true now.
I also tested it just now myself, IsBlank("") returns true, whereas IsBlank("somestring") returns false.
In the docs, you can see here:
IsBlank Power Apps - docs.microsoft.com
To simplify app creation, the IsBlank and Coalesce functions test for both blank values or empty strings
This is the way IsBlank works as of now, it tests for both blank values or empty strings so you shouldn't have to worry - if it's an empty string, or if it's Blank, IsBlank checks for both cases and will return true if either case is true. In case you also happen to remember it working that way before too, well this has changed and IsBlank does seem to test for empty strings according to the latest documentation as of this writing, and according to my testing just now.
In case you are still worried about it, you can do:
If(IsBlank(cbsi) || cbsi = "",cbsd,cbsi)
However, the above is redundant nowadays, IsBlank does also check for the empty string now, so you can just use:
If(IsBlank(cbsi),cbsd,cbsi)
See if it helps @MechEng2013