Skip to content

Latest commit

 

History

History
100 lines (73 loc) · 2.31 KB

File metadata and controls

100 lines (73 loc) · 2.31 KB

❗ IsError / IfError

Category: Error Handling | Works in: Canvas Apps


Overview

IsError tests if a value is an error record. IfError evaluates an expression and returns an alternative value if it results in an error.


Syntax

IsError( Value )
IfError( Value, Fallback [, Value2, Fallback2, ...] )

Simple Examples

1. Check Patch result

Set(varResult, Patch(Tasks, Defaults(Tasks), { Title: txtTitle.Text }));
If(IsError(varResult), Notify("Save failed.", NotificationType.Error))

2. Safe numeric conversion

IfError(Value(txtQty.Text), 0)

3. Fallback for failed LookUp

IfError(LookUp(Products, ID = varID).Price, 0)

Complex Examples

4. Full error-aware save with navigate

Set(varResult, Patch(Orders, Defaults(Orders), { Title: txtTitle.Text, Total: varTotal }));
If(
    IsError(varResult),
    Notify("Save failed: " & varResult.Message, NotificationType.Error, 6000);
    Trace("Patch failed", TraceSeverity.Error, { Msg: varResult.Message }),
    Notify("Order #" & varResult.ID & " created!", NotificationType.Success);
    Navigate(OrdersScreen)
)

5. IfError chain — live source with cache fallback

Set(varData, IfError(
    Filter(LiveData, AssignedTo = User().Email),
    varCachedData
))

6. Safe formula in a label (never show errors)

// Label Text — show calculated value or dash if it errors
IfError(
    Text(Gallery1.Selected.UnitPrice * Value(txtQty.Text), "$#,##0.00"),
    "—"
)

Best Practices

  • Validate inputs before using in write operations.
  • Combine with related functions for complete workflows.
  • Test with both empty and populated data sources.
  • Consider delegation when working with large data sets.

Related Functions

Function Relationship
Patch Related function
Notify Related function
Trace Related function
IfError Related function

🔗 Official Documentation

IsError, IfError – Microsoft Learn


Back to Home | Power Apps Formulas Reference | Last updated: May 2026