What is RequestHide Function?
The RequestHide function is a Power Fx function that allows you to hide a control or screen in your Power App. It is commonly used in scenarios where you want to hide a control or screen based on a certain condition or user interaction.
How to Use RequestHide Function?
Using the RequestHide function in your Power App is a simple process. The function takes a single argument, which is the control or screen that you want to hide. Let’s take a look at some examples to better understand how to use this function.
Example 1 – Hiding a Control Based on a Condition
Suppose you have a text input control in your Power App that is used to capture the user’s email address. You want to display a message to the user if they enter an invalid email address. To achieve this, you can add a label control to your app that will display the error message. Initially, you want to hide this control. Here is how you can do it:
1. Select the label control that you want to hide.
2. In the Properties pane, go to the Visible property and set it to the following formula:
This formula uses the IsMatch function to check if the email address entered by the user matches the pattern of a valid email address. If the email address is not valid, the formula returns true, which is negated by the ! operator. As a result, the Visible property of the label control is set to false, which hides the control.
3. Now, when the user enters an invalid email address, the label control will be displayed with the error message.
Example 2 - Hiding a Screen Based on User Interaction
Suppose you have two screens in your Power App - Screen1 and Screen2. When the user clicks a button on Screen1, you want to navigate to Screen2 and hide Screen1. Here is how you can do it:
1. Select the button control that the user will click to navigate to Screen2.
2. In the OnSelect property, add the following formula:
This formula uses the Navigate function to navigate to Screen2 and the RequestHide function to hide Screen1. The None argument is passed to the Navigate function to indicate that no data is being passed to Screen2.
3. Now, when the user clicks the button, they will be navigated to Screen2 and Screen1 will be hidden.
The RequestHide function is a powerful tool for hiding controls and screens in your Power App. It can be used to enhance the user experience of your app by showing and hiding elements based on specific conditions or user interactions. By using this function in combination with other Power Fx functions, you can create dynamic and engaging Power Apps that meet the needs of your business.