Skip to main content

Notifications

Community site session details

Community site session details

Session Id : ku/zYnFA3myg6FMOfX9vC7
Power Apps - Building Power Apps
Answered

!IsBlank() and !IsEmpty() for combo box

Like (2) ShareShare
ReportReport
Posted on 20 Jan 2019 03:28:36 by 4

Hello, guys. I just don't know what to do anymore, so PLEASE, give me a hand or two, if possible...

 

I have a job to do to my boss. I creater a powerapps screen that saves data in a Sharepoint List, but one field of this screen, a combo box, receives data from the List to charge the choices available. 

 

So here we are:

 

tela 1.PNG

 

If I let any of the marked fields (*) blank and press "Save", it is supposed to appear an error screen:

tela 2.PNG

 

So If I fill the blank fields, everything's ok!

 

tela 3.PNG

 

BUUUUUT if I unmark, de-select the combobox previously selected item...

 

tela 4.PNG

 

It keeps saving the data of this page on my Sharepoint List, and without one of the mandatory values... Did you understand?

 

This is what I put on Save button:

 

If(
!IsBlank(Titulo_Novo.Text) && <- this is the first mandatory item
(!IsEmpty(Unidade_Departamento_Regiao_Novo.Selected.Value) Or <- this line...
!IsBlank(Unidade_Departamento_Regiao_Novo.Selected.Value) <- and this line were supposed to be working, checking if the field (combo box), which is the second mandatory item, is not empty or is not blank!
)
&&
!IsBlank(Objeto_Novo.Text) <- this one is the third mandatory item.
;
Set(Borda_TituloNovo; Black);;Set(Borda_UnidadeNovo; Black);;Set(Borda_ObjetoNovo; Black);;Set(Borda_ValorNovo;Black);; <- here I'm turning all the three mandatory items borders black.

UpdateContext({Popup_Salva_Item:true}) && UpdateContext({Fundo_CinzaNovo:true}); <- here I'm showing an pop up information message and a gray screen behind it.

UpdateContext({Popup_Alerta_Campos:true}) && UpdateContext({Fundo_CinzaNovo:true}) <- here I'm showing an pop up warning message and a gray screen behind it.
)

 

The warning message should pop up on the screen if any of the three mandatory itens were blank. 

 

Why the heck is that rule on the save button working for the combo box only if I select and item and de-select it? How should it be the correct way to write this rule?...

 

Categories:
  • IswaryaPari Profile Picture
    7 on 13 Sep 2023 at 10:28:12
    Re: !IsBlank() and !IsEmpty() for combo box

    It works me

  • Community Power Platform Member Profile Picture
    on 08 May 2023 at 20:50:57
    Re: !IsBlank() and !IsEmpty() for combo box

    Use

    IsBlank(Name_of_Box.Selected.Value)

     

    and do something if it's blank... or....

    !IsBlank(Name_of_Box.Selected.Value)

     

    and have it do whatever if it's not blank...

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on 13 Mar 2023 at 18:13:14
    Re: !IsBlank() and !IsEmpty() for combo box

    @Krishna09 

    This sounds like a new problem. Post it as the answer will be lost here. 

  • Krishna09 Profile Picture
    234 on 29 Aug 2022 at 10:23:10
    Re: !IsBlank() and !IsEmpty() for combo box

    I had similar kind of issue but I couldn't solve it. 

    I replaced Como box type for a text card, on submit button selected, I want it to show error message when not selected. During form filling and submitting error message is working fine. But when I redrive data and view it and if i submit with out changing these particular columns which i have changed datatype, only they show  error message. Can you please explain why this is happening?

  • Community Power Platform Member Profile Picture
    on 12 Jul 2022 at 16:29:17
    Re: !IsBlank() and !IsEmpty() for combo box

    Hi all,

     

    I have kind of a similar problem.

    I have a button that is grayed out when there is no value in a combobox that is dependent of a dropdown list.

     

    DisplayMode on the Button:

    If(IsBlank(Choose_PH_Name);DisplayMode.Disabled)

    Everything works fine, EXCEPT when I click the "X" in that combo which ends up displaying no value and the button is NOT grayed out, allowing to click and navigate.

    Esle, if I change the dropdown item, than the combobox clears if there was any value in it, and the button is disabled (has blank() Default value). As I want it to.

     

    Tried lot's of solutions to no avail.

    Any help appreciated.

     

    Thank you,

    PSAR

  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on 20 Jan 2019 at 07:33:25
    Re: !IsBlank() and !IsEmpty() for combo box

    Hi @leomosqueira,

    FYI a Combobox contains a Table, even if it contains a single item or one column, so the appropriate function to test it would be IsEmpty() rather then IsBlank().  However, you can use IsBlank to test whether there is text in the Combobox's search property. 

    IsBlank(ComboBox1.SearchText)

    wil give a true/false result that can be used to change the Items property of a gallery or data table. I use this to remove the filter from a gallery using an UpdateContext() variable. 

    If(IsBlank(Combobox2.SearchText),UpdateContext({itms: mydatasource}),
    UpdateContext({itms:Filter(mydatasource,ID=Combobox.Selected.ID)})

    and then set the Items property of a gallery to itms. That way if text is not typed into the Combobox, all the items in the gallery are shown or else the gallery is filtered on the Combobox.

  • AndySid Profile Picture
    165 on 20 Jan 2019 at 07:11:39
    Re: !IsBlank() and !IsEmpty() for combo box

    If I understand you correctly, if there is no values in the ComboBox, or the values are removed from the ComboBox then show a message.

     

    In this example I disable the save button but the method is the same.

    The combobox Items are Units.Unit

     

    Rule: IsEmpty(ComboBox1.SelectedItems.Unit)

     DisplayMode for Submit (generated by the rule)

    If(Rule2, DisplayMode.Disabled
    , DisplayMode.Edit
    )

     

    Does this help, if so please mark as a solution (:

     

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 68 Most Valuable Professional

#2
mmbr1606 Profile Picture

mmbr1606 41 Super User 2025 Season 1

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 38

Overall leaderboard