Blank

Blank

How to Use the Power Fx Blank  Function in Power Apps

Understanding the concept of Blank Function

The Blank function is used to specify an empty value in your formula. It returns a blank value, which means there is no data in your field. It is useful when you want to set a field or a variable to a blank value. The syntax for the Blank function is as follows:


Blank()


The function doesn’t require any arguments, and when used, it returns a blank value.

Using the Blank Function in Power Apps

The Blank function is used in various ways in Power Apps. Here are examples of how to use it:

Setting a Field to Blank

If you want to set a field to a blank value, you can use the Blank function. For instance, if you have a form with several fields, and you want to clear them all, you can use the Blank function as follows:


UpdateContext({FieldName: Blank()})


The function above sets the field with the name ‘FieldName’ to a blank value, thus clearing the field.

Using Blank Function in an If Statement

In Power Apps, you can use an If statement to check if a condition is true or false. You can use the Blank function in an If statement to check if a field is empty. For instance, if you have a field called ‘FirstName,’ and you want to check if it is empty, you can use the Blank function as follows:


If(Blank() = FirstName, "Field is empty", "Field is not empty")


The function above checks if the ‘FirstName’ field is empty. If it is, it returns “Field is empty,” and if it’s not empty, it returns “Field is not empty.”

Using Blank Function in a Filter Function

The Filter function is used to find records in a data source that match specific criteria. You can use the Blank function in a Filter function to find records that have an empty value in a column. For instance, if you have a data source with a column called ‘City,’ and you want to find all records that have an empty value in the ‘City’ column, you can use the Blank function as follows:


Filter(DataSource, City = Blank())


The function above filters the data source to show only records that have an empty value in the ‘City’ column.

The Blank function is a powerful tool that can be used in various ways in Power Apps. It is useful when you want to specify an empty value in your formula. In this article, we have explored how to use the Power Fx Blank function in Power Apps. We hope this article has been helpful in understanding the concept of the Blank function.

Power Apps Training Courses by G Com Solutions (0800 998 9248)