ViewForm

How to Use the Power Fx ViewForm  Function in Power Apps

What is the ViewForm Function?

The ViewForm function is a Power Fx formula that allows users to display a specific form within a canvas app. This function is particularly useful when building complex applications that require multiple forms to be displayed based on specific user actions or inputs. The ViewForm function allows users to create a seamless user experience by displaying the correct form based on the context of the application.

How to Use the ViewForm Function

The ViewForm function requires two parameters: the name of the form to display and a record to display within the form. To use the ViewForm function, users must first create a form within their application. This can be done by selecting the “New Form” option from the “Insert” tab in the Power Apps Studio.

Once the form has been created, users can add the ViewForm function to their application by selecting the “Insert” tab and selecting the “Function” option. From here, users can select the “ViewForm” function and enter the required parameters.

Example Usage

Let’s explore a simple example of how to use the ViewForm function in a Power Apps application. In this example, we will create a simple application that allows users to view and edit information about their favorite movies.

First, we will create a list of movies within our application. This can be done by selecting the “New Screen” option from the “Insert” tab and selecting the “Gallery” option. We will then populate the gallery with a list of movies and allow users to select a movie to view or edit.

To view or edit a selected movie, we will create two forms: one for viewing and one for editing. We will call these forms “MovieViewForm” and “MovieEditForm”, respectively. Within the MovieViewForm, we will display all the information about the selected movie. Within the MovieEditForm, users will be able to edit the information about the selected movie.

To display the correct form based on user actions, we will use the ViewForm function. Within the gallery, we will add a button that, when clicked, will display the MovieViewForm for the selected movie. We will also add an “Edit” button that, when clicked, will display the MovieEditForm for the selected movie.

To achieve this, we will use the following ViewForm functions:


ViewForm("MovieViewForm", ThisItem)



ViewForm("MovieEditForm", ThisItem)


The first ViewForm function will display the MovieViewForm for the selected movie, while the second ViewForm function will display the MovieEditForm for the selected movie.

The ViewForm function is a powerful tool within the Power Fx formula language that allows users to display specific forms within their Power Apps applications. By using the ViewForm function, users can create custom applications that are tailored to their specific business needs. With the ability to display forms based on specific user actions or inputs, users can create a seamless user experience that is both intuitive and efficient.

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