Clear

Clear

How to Use the Power Fx Clear  Function in Power Apps

What is Power Fx?

Power Fx is a low-code programming language that is used in Power Apps to create custom formulas and logic. It is a simple and easy-to-learn language that is based on Microsoft Excel formulas and functions. Power Fx is designed to make it easy for non-technical users to create custom apps without the need for traditional coding skills.

What is the Clear function?

The Clear function is a Power Fx function that is used to reset the value of a control to its default value. It is a very useful function that can be used to clear the contents of a text box, drop-down list, or any other type of input control. The Clear function can also be used to reset the value of a variable or data source.

How to use the Clear function in Power Apps

Using the Clear function in Power Apps is very simple. To use the Clear function, you need to follow the steps below:

1. First, select the control that you want to clear.

2. Next, go to the Properties pane and select the OnSelect property.

3. In the OnSelect property, type the following formula: Clear(ControlName)

**Note:** Replace ControlName with the name of the control that you want to clear.

4. Save the formula and preview the app.

**Note:** You can also use the Clear function in other Power Fx formulas and expressions.

Examples of using the Clear function

Here are some examples of how to use the Clear function in Power Apps:

Clearing the contents of a text box

To clear the contents of a text box, you need to follow these steps:

1. Select the text box that you want to clear.

2. Go to the Properties pane and select the OnSelect property.

3. In the OnSelect property, type the following formula: Clear(TextBox1)

**Note:** Replace TextBox1 with the name of the text box that you want to clear.

4. Save the formula and preview the app.

Clearing the selected value of a drop-down list

To clear the selected value of a drop-down list, you need to follow these steps:

1. Select the drop-down list that you want to clear.

2. Go to the Properties pane and select the OnSelect property.

3. In the OnSelect property, type the following formula: Clear(DropDownList1)

**Note:** Replace DropDownList1 with the name of the drop-down list that you want to clear.

4. Save the formula and preview the app.

Clearing the contents of a data source

To clear the contents of a data source, you need to follow these steps:

1. Select the data source that you want to clear.

2. Go to the Properties pane and select the OnSelect property.

3. In the OnSelect property, type the following formula: Clear(DataSource1)

**Note:** Replace DataSource1 with the name of the data source that you want to clear.

4. Save the formula and preview the app.

The Power Fx Clear function is a very useful tool in Power Apps that allows you to reset the value of a control to its default value. By following the simple steps outlined in this article, you can easily use the Clear function in your custom Power Apps. Whether you are clearing the contents of a text box, drop-down list, or data source, the Clear function is a powerful and flexible tool that can help you create the perfect custom app for your business needs.

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