Live training: next batches coming soon. Join the waitlist:Waitlists open:Developer Training →Developer →Copilot Studio Training →Copilot Studio →

How to Patch a Dataverse Number Field in Power Apps (and Fix the Text to Number Error)

Our service desk tags every device with a numeric Asset Tag, and techs wanted to type it into a canvas app instead of the Dataverse grid. The catch: a text box gives you text, and the column wants a number.

In this tutorial, we’ll patch a Dataverse number field in Power Apps: update a row, add a new one, convert text to a number with Value(), and stop bad input before it reaches the server.

Here’s what we’re building: a screen whose buttons save 10045990 to a Whole Number column, shown in a gallery of the newest rows.

Power Apps preview gallery showing Scanner Setup and Printer Setup both saved with Asset Tag 10045990

Before You Start

You need a Power Apps license that covers Dataverse and a role that can edit the table. Dataverse stores data in tables made of rows and columns; new to it? Start with what Microsoft Dataverse is.

I used the Service Request table (plural name Service Requests) in my Power Platform developer environment. These are the columns we touch:

ColumnTypeNotes
SubjectText (primary column)We find rows by it, e.g. Printer Setup
Asset TagWhole Number, format NoneLogical name cr85a_assettag; range 0 to 2147483647
CustomerLookup to CustomersA server rule requires it on new rows

I created Asset Tag for our post on how to remove commas from a Dataverse number field; that’s also where the grid’s 10,045,872-style commas come from.

Step 1: Build the Screen

Build a bare app in a few clicks (no shots needed here):

  1. On make.powerapps.com, select Create > Start with design > Blank canvas app, and pick Tablet.
  2. Select Data > Add data, search Service Requests, and add the Dataverse table. Add Customers too.
  3. Insert a classic Text input, rename it txtAssetTag, and set its Default to 10045990.
  4. Insert a vertical gallery with Items set to the formula below, and show Subject, Asset Tag and Modified On.
FirstN(Sort('Service Requests', 'Modified On', Descending), 8)

To set a property, select the control, pick the property in the dropdown left of the formula bar (fx), and type. Save often with Ctrl+S.

Checkpoint: the gallery lists your eight newest Service Requests.

Step 2: See the Text to Number Type Error

Let’s make the mistake everyone makes first. Add a button, select OnSelect, and pass the text box straight to the column:

Patch('Service Requests',
    LookUp('Service Requests', Subject = "Printer Setup"),
    {'Asset Tag': txtAssetTag.Text})

Studio flags it right away with a red X on the button and a squiggle under txtAssetTag.Text. Hover it and you get:

The type of this argument 'cr85a_assettag' does not match the expected type 'Number'. Found type 'Text'.
Power Apps formula bar tooltip saying cr85a_assettag expected type Number but found type Text with a red X on the button

Patch checks each value against the column type. A text input’s .Text is always Text, even when it holds digits. Choice and lookup columns raise a similar mismatch, covered in the does not match the expected type Record error.

Checkpoint: you see the red X, so you know the app won’t save anything yet.

Step 3: Convert Text to Number with Value() and Update a Row

The fix is one function. Value() turns text such as “10045990” into the number 10045990. Our Power Apps Value function guide covers it in depth. Put this in a second button’s OnSelect:

Patch('Service Requests',
    LookUp('Service Requests', Subject = "Printer Setup"),
    {'Asset Tag': Value(txtAssetTag.Text)})
Power Apps OnSelect property selected with the Patch formula that wraps txtAssetTag.Text in Value

LookUp finds the first row whose Subject is Printer Setup (the record to change), and the third argument lists only the column we change. Other columns stay as they are.

Run it: press F5 or Play at the top right, or hold Alt and click the button in the editor.

Checkpoint: the Printer Setup row shows Asset Tag 10045990 in the gallery.

Step 4: Add a New Row with a Number Value

Adding a row works the same way, with Defaults('Service Requests') as the base record. Our table also has a server rule that blocks new rows without a customer, so we set Customer:

Set(varNum, Patch('Service Requests', Defaults('Service Requests'), {
    Subject: "Scanner Setup",
    Customer: LookUp(Customers, 'Customer Name' = "Dan"),
    'Asset Tag': Value(txtAssetTag.Text)}));
Notify("Saved Asset Tag " & varNum.'Asset Tag')
Power Apps Patch Defaults formula adding Scanner Setup with Customer and Value of txtAssetTag and the Add row button

Patch returns the saved record, so varNum.'Asset Tag' shows the value Dataverse stored, and the Notify function displays it. More ways to create rows are in add data to a Dataverse table.

Checkpoint: a banner reads Saved Asset Tag 10045990 and Scanner Setup appears at the top of the gallery.

Step 5: Validate the Number Before You Patch

Value() fails on text like “abc”, and the user then sees a confusing server banner. Check first, patch second:

If(IsError(Value(txtAssetTag.Text)) ||
    IsBlank(Value(txtAssetTag.Text)),
    Notify("Type a whole number", NotificationType.Error),
    Patch('Service Requests', LookUp('Service Requests', Subject = "Printer Setup"),
        {'Asset Tag': Value(txtAssetTag.Text)}))
Power Apps formula that checks IsError and IsBlank on Value before calling Patch

IsError catches text that isn’t a number; IsBlank catches an empty box. Only when both pass does Patch run. I typed abc to test it:

Power Apps preview red banner Type a whole number after typing abc in the Asset Tag box

Checkpoint: the red Type a whole number banner shows and no row changes.

Test the App

Here’s what my 10/31/2026 run in Preview produced on the same two rows:

ButtonInputResult
Update with Value()10045990Printer Setup saved 10045990
Add row10045990Banner “Saved Asset Tag 10045990”; new Scanner Setup row
Patch Text (no Value)anyDesign-time type error; can’t run
Validate, then PatchabcBanner “Type a whole number”; nothing saved

Clean up test rows later with delete all records from a Dataverse table.

Variant: Add 1 to the Stored Number

Counters (visits, reprints, stock) need the current value plus one. Read it with LookUp inside the Patch:

Patch('Service Requests',
    LookUp('Service Requests', Subject = "Printer Setup"),
    {'Asset Tag': LookUp('Service Requests',
        Subject = "Printer Setup").'Asset Tag' + 1})
Power Apps preview gallery with Printer Setup Asset Tag increased from 10045990 to 10045991

Printer Setup went from 10045990 to 10045991. No Value() is needed here because the column already returns a number.

Whole Number, Decimal, Float or Currency Column?

All four take a Number in Power Fx, so the same Patch with Value() works. Pick the type for what you store:

TypeUse it forWatch out
Whole NumberIDs, counts, tagsNo decimals; 12.7 fails
Decimal NumberExact values for reportsStored exactly as typed
Floating Point NumberFractions compared with > or <Stores a close approximation
CurrencyMoneyAdds Currency, Exchange Rate and a _Base column

A Dataverse currency column also has a precision setting (pricing, currency or a fixed 0 to 4). Apps handle up to 15 digits precisely, and phone numbers belong in a text column, not a number column.

Troubleshooting

I sent bad values through the unguarded update button to see the real errors. Text that isn’t a number (abc):

Power Apps red banner The value abc cannot be converted to a number

A decimal into a whole number column (12.7) failed with a long “Network error when using Patch function” banner ending in Cannot convert the literal '12.7' to the expected type 'Edm.Int32'. Fix: Round(Value(txtAssetTag.Text), 0) turns 12.7 into 13, or switch to a Decimal column.

Power Apps error banner Cannot convert the literal 12.7 to the expected type Edm.Int32

A number out of range (3000000000) returned “Value must be between 0 and 2147483647”, the column’s limit. After a failed run Studio also puts a red X on the button.

Power Apps error banner Value must be between 0 and 2147483647 after typing 3000000000

Note: Value() reads text in the user’s language. In en-US, “10,045,990” becomes 10045990, but in fr-FR a comma is the decimal separator. Pass a language tag such as Value("12,7", "fr-FR") when input comes from another locale.

Where to Take It Next

More builds like this are on our Power Apps tutorials hub.

Planning more Dataverse work? These pair well with this build:

Frequently Asked Questions

How do I patch text to a number field in Power Apps?

Wrap the text in Value(), for example {‘Asset Tag’: Value(txtAssetTag.Text)}. Without it, Patch shows “does not match the expected type ‘Number’. Found type ‘Text’.”

Why does Patch say expected type ‘Number’ but found type ‘Text’?

A text input’s .Text is always Text, even with digits. Convert it with Value(); the Value function reference explains the language rules.

How do I patch a Dataverse currency column?

The same way: Patch takes a Number, so use Value() on text input. Dataverse adds Currency, Exchange Rate and _Base columns for you, as described in Column data types in Dataverse.

Can I patch a decimal into a Dataverse whole number column?

No. 12.7 failed with “Cannot convert the literal ‘12.7’ to the expected type ‘Edm.Int32’.” Round it first with Round(Value(txtAssetTag.Text), 0) or use a Decimal column.

How do I add 1 to a Dataverse number column with Patch?

Read the current value with LookUp and add 1 inside the change record. Our Printer Setup row went from 10045990 to 10045991.