UpdateIf

How to Use the Power Fx UpdateIf  Function in Power Apps

In this article, we will explore the UpdateIf function and how to use it in Power Apps. We will also provide some real-world examples to help you understand the function better.

What is the UpdateIf Function?

The UpdateIf function in Power Apps is used to update one or more records in a data source. The function works by evaluating a condition and updating the record(s) that meet the condition. The UpdateIf function syntax is as follows:


– datasource: the data source that you want to update.

– condition: a condition that is evaluated for each record in the data source.

– updates: a set of updates that are applied to the records that meet the condition.

How to Use the UpdateIf Function?

To use the UpdateIf function in Power Apps, follow the steps below:

1. Open the app in Power Apps that you want to update.

2. Select the control that you want to use to trigger the update.

3. In the OnSelect property of the control, add the UpdateIf function with the desired parameters.

4. Save and test the app to see the updates.

Let’s take a closer look at each of these steps.

Step 1: Open the App in Power Apps

To use the UpdateIf function, you need to have an app created in Power Apps. If you don’t have an app yet, you can create one by following the instructions provided by Microsoft.

Step 2: Select the Control

Once you have opened the app, you need to select the control that you want to use to trigger the update. This control can be a button, a text input field, or any other control that you want to use.

Step 3: Add the UpdateIf Function

In the OnSelect property of the selected control, add the UpdateIf function with the desired parameters. The parameters should include the data source, the condition, and the updates.


For example, if you want to update the price of a specific item in a SharePoint list, you can use the following UpdateIf function:


In this example, we are updating the record with ID=1 in the MySharePointList data source. We are updating the price of the item to 10.

Step 4: Save and Test the App

Once you have added the UpdateIf function, save the app and test it to see the updates. When you click on the selected control, the records that meet the condition will be updated with the specified updates.

Real-World Examples

Let’s look at some real-world examples to help you understand how to use the UpdateIf function better.

Example 1: Updating a SharePoint List

Suppose you have a SharePoint list that contains a list of products with their prices. You want to update the price of a specific product based on its ID. You can use the UpdateIf function to update the record with the specified ID.


In this example, we are updating the price of the product with ID=1 to 10.

Example 2: Updating a SQL Server Database

Suppose you have a SQL Server database that contains a list of customers and their orders. You want to update the order status of a specific customer based on their customer ID. You can use the UpdateIf function to update the record with the specified ID.


In this example, we are updating the order status of the customer with ID=1 to “Completed”.

The UpdateIf function is a powerful feature that allows you to update records in a data source based on certain conditions. This function is especially useful when you want to update only specific records and leave the rest unchanged. By following the steps outlined in this article, you can easily use the UpdateIf function in your Power Apps to create dynamic and responsive apps.

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