I set a bunch of combo-boxes (single selection) as filters for the gallery.
While filters do work using Combobox1.Selected.Value, IsBlank or IsEmpty show false, even if empty.
I need it to work because I want to display a banner that says "filters are active" when at least one filter is triggered.
Now, that banner is always active, even if there is nothing in the combo boxes.
Can somebody please tell me the correct syntax for evaluating is there a selected item in the combo box?
Solved! Go to Solution.
Hi@vladimir84,
Based on your needs, I think you could combine the IsEmpty() and IsBlank().
In my scenario, I add a Label and set the Visible property as below:
If(
IsEmpty(ComboBox1.Selected) Or IsBlank(ComboBox1.Selected),
false,
true
)
Note: Please do use the ComboBox1.Selected rather than the ComboBox1.Selected.Value.
Best Regards,
Qi
Hi@vladimir84,
Combine that with your description, I think you have some misunderstanding with the IsBlank() function and the IsEmpty() function.
The IsBlank() function is used to check if a value is Blank. The IsEmpty() function is used to test whether a table contains any records, in other words, the IsEmpty() function is used to detect if there is no records within a Table.
More details about IsBlank() function and IsEmpty() function, please check the following article:
IsBlank() function and IsEmpty() function
I have a test on my side and the situation is confirmed on my side.
Add a Label and set the Text property as below:
"" = Blank()
Empty string ("") refers to a string that contains no characters.
The Empty string ("") is not equal to Blank. You could see that the above formula would always return false, that is proof.
I assume that there is no "" value within the array data related to the Combo Box, if you want to check if a Combo Box value is Blank, please take a try with the following workaround:
Add a Button and set the DisplayMode property of the Button1 as below:
If(
IsEmpty(ComboBox1.SelectedItems),
DisplayMode.Disabled,
DisplayMode.Edit
)
Add a Label and set the Text property as below:
"filters are active"
Set the Visible property of the Label as below:
If(Button1.DisplayMode=Edit,true,false)
Hope it could help.
Best Regards,
Qi
Dear @v-qiaqi-msft ,
Thank you for your answer.
IsEmpty(ComboBox1.SelectedItems) does not work (shows true when the list is empty) and this was the main reason why I was asking the question, I suspected that there is a bug.
Now the question is, has this ever happened before?
If yes, let's see the solution, if no, I'll open a support ticket.
I have to provide you with some constructive criticism, given that you're an employee of MS rather than a volunteer.
Br,
In your case of testing the SelectedItems, you can use this formula:
CountRows(Combobox1.SelectedItems)=0
This will be true if nothing is selected and false if items are selected.
I hope this is helpful for you.
Hi@vladimir84,
Based on your needs, I think you could combine the IsEmpty() and IsBlank().
In my scenario, I add a Label and set the Visible property as below:
If(
IsEmpty(ComboBox1.Selected) Or IsBlank(ComboBox1.Selected),
false,
true
)
Note: Please do use the ComboBox1.Selected rather than the ComboBox1.Selected.Value.
Best Regards,
Qi
Take a look, I think something is buggy with the app (perhaps the passage of development version?). I'm thinking I'll export-import it as a new one, and try that.
Hi Qi,
Your solution works! I will take it as instruction to use Selected instead of SelectedItems.
Thank you.
User | Count |
---|---|
253 | |
122 | |
106 | |
54 | |
48 |