cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Advocate III
Advocate III

Empty combobox, wrong IsBlank value

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?

1 ACCEPTED SOLUTION

Accepted Solutions

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

 

View solution in original post

7 REPLIES 7
Community Support
Community Support

Hi @vladimir84,

Check the second reply.

Best Regards,

Qi

Community Support
Community Support

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() 

 

04.png

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.

111701GIF.gif

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.

  • The aim of the question is to find the specific solution - your answer is overly exhaustive and (even though I'm sure you're only trying to help) it looks like you're lecturing the client on basics, because of what you think happened. My suggestion: hyperlink the references and examples, keep the answers very brief, and ask for more information when you think something happened (sometimes, you might be thinking in the wrong direction for the right reasons).
  • IsBlank and IsEmpty are used interchangeably in the question for a reason, they have been under-documented and unintuitive (you'd use one with Filter the other with Lookup and they both do exactly the same thing). Add to that a redundant coding for combobox (Selected and SelectedItems), and reliance on the forums and youtube, the requirement becomes giving a precise formula for the outcome, to eliminate any doubt what to use in that situation. 

Br,

 

Super User III
Super User III

@vladimir84 

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.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

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

 

View solution in original post

@RandyHayes 

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.

vladimir84_0-1606119618914.png

 

@v-qiaqi-msft 

Hi Qi,

Your solution works! I will take it as instruction to use Selected instead of SelectedItems.

Thank you.

vladimir84_1-1606119791055.png

 

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (34,579)