How to Patch Dataverse Number Field in Power Apps

Do you know how to patch Dataverse Number field in Power Apps? No worries. In this Dataverse tutorial, we will discuss what are the possible and easiest ways to update a Dataverse Number Column in Power Apps.

Also, we will cover the topics below:

I recently had a project where I wanted to use Power Apps to patch the Dataverse Number field. Also, I had to use a Dropdown control to update the Dataverse Number column. I then had some thoughts and ideas that I want to share in this post. Let’s investigate this now.

Patch Dataverse Number Field in Power Apps

First of all, What does mean by Patch Dataverse Number Field in Power Apps? Let’s understand this from the below scenario.

Scenario:

The below screenshot represents a Dataverse Table named Car Details. This table has various columns (with different data types) like:

  1. Car Name = Primary Column name with a Single line of text data type
  2. Car Owner = Single line of text data type
  3. Owner Contact Number = This is a Number Column
  4. Booking Date = Date column
  5. Color = Choice Column
  6. Country = Choice Column
  7. Price = Currency Column

Also, you can see the Dataverse table has all the below records. Now I would like to patch the Owner Contact Number of the third record i.e. Smith.

Patch Dataverse Number Field in Power Apps
Patch Dataverse Number Field in Power Apps
  • In Power Apps, insert a Button Control and rename it to Update Owner Contact Number.
  • Select the button control and apply the code below on its OnSelect property as:
OnSelect = Patch(
    'Car Details',
    LookUp(
        'Car Details',
        'Car Owner' = "Smith"
    ),
    {'Owner Contact Number': 1117826710}
)

Where,

  1. Patch = Power Apps Patch Function is used to create a new record or modify single or multiple records in a data source.
  2. ‘Car Details’ = Provide Dataverse Table Name
  3. LookUp = Power Apps LookUp function locates the first record in a table that fulfills a formula.
  4. ‘Car Owner’ = Provide the Dataverse column name of whom you want to update the value
  5. “Smith” = Specify the owner name of whom you want to update the value
  6. ‘Owner Contact Number’ = Dataverse Number Field
  7. 1117826710 = Specify the integer value that you want to update in the Dataverse number column

NOTE:

But before applying the above code, make sure you need to connect the Dataverse Connector and choose the Dataverse table (Car Details) to Power Apps. If not, you can experience certain issues.
How to Patch Dataverse Number Field in Power Apps
How to Patch Dataverse Number Field in Power Apps
  • Now Save and Publish the app. Preview the app and tap on the button (Update Owner Contact Number). Then come back to the specific Dataverse table (Car Details) and refresh it once. You can see the specific Dataverse number field value has been updated to the new one as shown below.
How to patch Dataverse Number Column in Power Apps
Power Apps Patch Dataverse Number Field

This is how to Patch Dataverse Number Field in Power Apps.

See also  How to Save Data to Multiple SharePoint Lists in Power Apps?

Patch Dataverse Number Field using Power Apps Dropdown Control

Next comes how we can update or patch Dataverse Number Field using Power Apps Dropdown Control.

  • In the below Dataverse table (Car Details), you can see there is a Number column named Current Mileage. Now I would like to update the Current Mileage of the second record i.e. Reyon (Car Owner).
  • To patch the Dataverse Number value, we can also use the Power Apps Dropdown control.
Patch Dataverse Number Field using Power Apps Dropdown Control
Patch Dataverse Number Field using Power Apps Dropdown Control
  • In Power Apps, insert a Dropdown control and get all the dataverse number values using the code below (Items property):
Items = Distinct(
    'Car Details',
    'Current Mileage'
)

Where,

  1. Distinct = A formula can be evaluated across all table records with the help of Power Apps distinct function, which then delivers a one-column table with the results with duplicate values deleted.
  2. Car Details = Dataverse Table Name
  3. Current Mileage = Dataverse Number Column Name
Patch Dataverse Number column using Power Apps Dropdown
Patch Dataverse Number column using Power Apps Dropdown
  • Now, add a button control (Click Here!) and set its OnSelect property to the code below:
OnSelect = Patch(
    'Car Details',
    LookUp(
        'Car Details',
        'Car Owner' = "Reyon"
    ),
    {'Current Mileage': ddSelectMileage.Selected.Value}
)

Where,

  1. ‘Car Details’ = Dataverse Table name
  2. ‘Car Owner’ = Provide the Dataverse column name of whom you want to update the value
  3. “Reyon” = Specify the owner name of whom you want to update the value
  4. ‘Current Mileage’ = Dataverse Number Field Name
  5. ddSelectMileage = Dropdown Control Name
Update Dataverse Number column using Power Apps Dropdown
Patch Dataverse Number Column in Power Apps
  • Now Save and Publish the app. Preview the app, Select any value from the dropdown control, and tap on the button (Click Here!).
  • Then come back to the specific Dataverse table (Car Details) and refresh it once. You can see the specific Dataverse number field value has been updated to the new one as shown below.
How to update Dataverse Number field in Power Apps
How to update Dataverse Number field in Power Apps

In this way, we can update Dataverse Number Field using Power Apps Dropdown Control.

Also, Read: PowerApps Cascading Dropdown (Detailed tutorial)

Patch Dataverse Number Field using Power Apps Combobox Control

Now we will check how to patch the Dataverse Number Field using Power Apps Combobox Control.

  • In this scenario also, I have taken the same above Dataverse table (Car Details) and the same Number field as Current Mileage.
  • Next, I would like to update or patch the Dataverse number field value of the fifth record Steward using a Power Apps Combobox control (with Allow Single Value).
Update Dataverse Number field in Power Apps
Update Dataverse Number field in Power Apps
  • In Power Apps, insert a Combobox control (Allow Single Value) and get all the dataverse number values using the code below (Items property):
Items = Distinct(
    'Car Details',
    'Current Mileage'
)
  • Now, apply the code below on the button’s OnSelect property:
OnSelect = Patch(
    'Car Details',
    LookUp(
        'Car Details',
        'Car Owner' = "Steward"
    ),
    {'Current Mileage': cbSelMileage.Selected.Value}
)

Where,

  1. ‘Car Details’ = Provide Dataverse Table name
  2. ‘Car Owner’ = Provide the Dataverse column name of whom you want to update the value
  3. “Steward” = Specify the name of whom you want to update the value
  4. ‘Current Mileage’ = Dataverse Number Field name
  5. cbSelMileage = Power Apps Combo box control name (Allow Single Value only)
Power Apps Update Dataverse Number field
Power Apps Update Dataverse Number field
  • Now Save and Publish the app. Preview the app, Select any value from the combo box control, and tap on the button (Tap & Update).
  • Go to the specific Dataverse table (Car Details) and refresh it once. You can see the specific Dataverse number field value has been updated to the new one as shown below.
How to Update Dataverse Number Column using Power Apps Combobox
How to Update Dataverse Number Column using Power Apps Combobox

This is how to Patch Dataverse Number Field using Power Apps Combobox Control.

See also  How to Use Slider in Power Apps?

Check out: Power Apps Rating Control – How to use

Patch Dataverse Number Field using Power Apps Text input Control

Do you know how to Patch Dataverse Number Field using Power Apps Text input Control? Well, refer to the Power Apps code below to achieve this.

  • I used the same Dataverse table (Car Details) as earlier and the same Number column (Current Mileage) for this situation as well.
  • Using a Power Apps Text input control, I would then like to modify or patch the Dataverse number field value of the fourth record Alexander.
Patch Dataverse Number Field using Power Apps Text input Control
Patch Dataverse Number Field using Power Apps Text input Control
  • In Power Apps, insert a Text input control and rename it to txtEnterMileage.
  • Add a Button control (Click & Update) and set its OnSelect property to the code below:
OnSelect = Patch(
    'Car Details',
    LookUp(
        'Car Details',
        'Car Name' = "Duster"
    ),
    {'Current Mileage': Value(txtEnterMileage.Text)}
)

Where,

  1. ‘Car Details’ = Provide Dataverse Table name
  2. ‘Car Name’ = This is my Dataverse Primary Column Name
  3. “Duster” = Specify the car name that you want to update the number
  4. ‘Current Mileage’ = Dataverse Number Field name
  5. txtEnterMileage = Power Apps Text input control name

Refer to the image below.

Update Dataverse Number Field using Power Apps Text input Control
Update Dataverse Number Field using Power Apps Text input Control
  • Now Save and Publish the app. Preview the app, Enter the value in the text input control that you want to update in the Dataverse number field, and tap on the button (Click & Update).
  • Navigate to the Car Details Dataverse table and do a single refresh. You can see that the value of the specified Dataverse number field has been changed to the one displayed below.
How to update Dataverse Number column in Power Apps
How to update Dataverse Number column in Power Apps

This is how to update Dataverse Number Field using Power Apps Text input Control.

Patch Dataverse Number Field using Power Apps Slider Control

Next, we will see how to update Dataverse Number Field using a Power Apps Slider Control.

  • For this scenario, I also used the same Dataverse Number column (Current Mileage) and Dataverse table (Car Details) as earlier.
  • I would then like to change or patch the Dataverse number field value of the first record Audi using a Power Apps Slider Control.
Update Dataverse Number Field using Power Apps Slider
Update Dataverse Number Field using Power Apps Slider
  • In Power Apps, add a Slider control and rename it to sdMileage.
  • Insert a Button control (Click & Update) and set its OnSelect property to the code below:
OnSelect = Patch(
    'Car Details',
    LookUp(
        'Car Details',
        'Car Name' = "Audi"
    ),
    {'Current Mileage': sdMileage.Value}
)

Where,

  1. ‘Car Details’ = Provide the Dataverse Table name
  2. ‘Car Name’ = This is my Dataverse Primary Column Name
  3. “Audi” = Specify the car name that you want to update the number
  4. ‘Current Mileage’ = Dataverse Number Field name
  5. sdMileage = Power Apps Slider control name
How to Update Dataverse Number Field using Power Apps
How to Update Dataverse Number Field using Power Apps
  • Now Save the app, then publish it. To update a specific value in the Dataverse number field, open the app in preview mode, move the slider to that value, and then hit the button (Click & Update).
  • Do a single refresh in the Car Details Dataverse table by navigating there. The value of the selected Dataverse number field has been changed to the one shown below, as you can see.
Patch Dataverse Number Field using Power Apps Slider Control
Patch Dataverse Number Field using Power Apps Slider Control

This is how to patch Dataverse Number Field using Power Apps Slider Control.

See also  Power Apps Import Package Error: Something went wrong. Please try again later.

Have a look: How to Detect Text in Dataverse Using AI Builder

Patch Dataverse Number Field using Power Apps Edit Form Control

Finally, We will see how to Patch Dataverse Number Field using Power Apps Edit Form Control.

The below screenshot represents a Dataverse table named Patient Registrations. In this table, there are various columns with various data types. Such as:

  1. Patient Name = This is a Primary column having with Single line of text data type.
  2. DOB = Date Data type
  3. Age = Whole Number Data type
  4. Address = Multi-line of text Data type
  5. Reason = Dataverse Choice Column
  6. Patient Phone Number = Dataverse Phone Number Column
Patch Dataverse Number Field using Power Apps Edit Form Control
Patch Dataverse Number Field using Power Apps Edit Form Control
  • In Power Apps, there is an Edit form control with all the Dataverse fields including the Number field (Age). Now I would like to create a new record in the Dataverse table when a user will click on the REGISTER button.
PowerApps Update Dataverse Number Field
PowerApps Update Dataverse Number Field
  • To do so, select the button control (REGISTER) and apply the code below on its OnSelect property as:
OnSelect = Patch(
    'Patient Registrations',
    Defaults('Patient Registrations'),
    {
        'Patient Name': DataCardValue1.Text,
        'Patient Phone Number': DataCardValue6.Text,
        DOB: DateValue1.SelectedDate,
        Age: Value(DataCardValue3.Text),
        Address: DataCardValue4.Text,
        Reason: DataCardValue5.SelectedItems
    }
)

Where,

  1. Patch = Power Apps Patch Function is used to create a new record or modify single or multiple records in a data source.
  2. ‘Patient Registrations’ = Provide Dataverse Table name
  3. Age = Dataverse Number Field Name
  4. DataCardValue3 = Data card value of Age

Refer to the screenshot below.

Patch Dataverse Number Field using Power Apps
Patch Dataverse Number Field using Power Apps
  • Finally, save and publish the app. Preview the app and enter all the details in the form including the age. Then, click on the REGISTER button.
  • Go to the specific dataverse table and refresh it. You will see a new record has been created including the number field i.e. Age.

This is how to update Dataverse Number Field using Power Apps Edit Form Control.

Furthermore, you may like some more Dataverse tutorials:

In this Dataverse tutorial, we discussed what are the possible and easiest ways to update a Dataverse Number Column in Power Apps.

Also, we covered the topics below:

  • How to Patch Dataverse Number Field using Power Apps Dropdown Control
  • Update Dataverse Number Field using Power Apps Combobox Control
  • Patch Dataverse Number Field using Power Apps Text input Control
  • Update Dataverse Number Field using Power Apps Slider Control
  • How to update Dataverse Number Field using Power Apps Edit Form Control
>