Latest Posts

PowerApps Check if value is blank or not


The IsBlank function in Power Apps is used to determine whether a value is blank or not. This function is particularly useful for checking whether fields are empty, whether controls contain data, or for validating user input.

PowerApps – IsBlank() function Syntax

IsBlank(Value)

  • Value: The value, control, or data field to check for blankness.

Notes:

  1. Empty Strings vs. Blank: Remember that IsBlank checks for both Blank() and empty strings. An empty string ("") is considered blank.
  2. User Feedback: Provide clear feedback to users when fields are left blank, guiding them to fill in the necessary information.
  3. Form Validation: Use IsBlank to check if required fields are empty and display error messages or disable submit buttons until all required fields are filled.

PowerApps – Check If a Text Input is Blank

Suppose you want to check if a Text Input control is empty.

  1. Add a Text Input Control:
    • Insert a Text Input control named TextInput1.
  2. Add a Label Control to Display the Result:
    • Insert a Label control.
    • Set the Text property of the Label to:

If(IsBlank(TextInput1.Text), "Input is blank", "Input is not blank")

This will display "Input is blank" if the TextInput1 control is empty, and "Input is not blank" if it contains text.

PowerApps – Check If a Variable is Blank

Suppose you have a variable and you want to check if it is blank.

  1. Add a Button Control to Set the Variable:
    • Insert a Button control.
    • Set the OnSelect property of the Button to:

Set(MyVariable, Blank())

  1. Add a Label Control to Display the Result:
    • Insert a Label control.
    • Set the Text property of the Label to:

If(IsBlank(MyVariable), "Variable is blank", "Variable is not blank")

When the button is clicked, it sets MyVariable to blank, and the label will display "Variable is blank".

PowerApps – Use IsBlank function with Data Fields

Suppose you have a collection named Products and you want to check if the Description field of the first product is blank.

  1. Create the Collection:

ClearCollect(Products,

    Table(

        {ProductID: 1, ProductName: "Laptop", Description: "High-end gaming laptop"},

        {ProductID: 2, ProductName: "Tablet", Description: ""},

        {ProductID: 3, ProductName: "Monitor"}

    )

);

  1. Add a Label Control to Display the Result:
    • Insert a Label control.
    • Set the Text property of the Label to:

If(IsBlank(First(Products).Description), "Description is blank", "Description is not blank")

This will display "Description is not blank" for the first product because its Description field contains text.

PowerApps – Check If a Dropdown Selection is Blank

Suppose you want to check if a user has made a selection in a Dropdown control.

  1. Add a Dropdown Control:
    • Insert a Dropdown control named Dropdown1.
    • Set the Items property to:

 ["Option 1", "Option 2", "Option 3"]

  1. Add a Label Control to Display the Result:
    • Insert a Label control.
    • Set the Text property of the Label to:

If(IsBlank(Dropdown1.Selected), "No selection made", "Selection made")

This will display "No selection made" if no option is selected in the dropdown, and "Selection made" if an option is selected.


We value your Feedback:

Page URL:

Name:

 

Email:

 
 

Suggestion:

 

© 2024 Code SharePoint