|
| 1 | +--- |
| 2 | +title: "Formula repair in Power Apps (preview) | MicrosoftDocs" |
| 3 | +description: Understand how to enable and use formula repair in Power Apps |
| 4 | +ms.custom: "" |
| 5 | +ms.date: 09/30/2022 |
| 6 | +ms.reviewer: tapanm-msft |
| 7 | +ms.topic: overview |
| 8 | +author: norliu |
| 9 | +ms.subservice: common |
| 10 | +ms.author: norliu |
| 11 | +search.audienceType: |
| 12 | + - maker |
| 13 | +search.app: |
| 14 | + - PowerApps |
| 15 | +contributors: |
| 16 | + - tapanm-msft |
| 17 | + - norliu |
| 18 | +--- |
| 19 | + |
| 20 | +# Formula repair in Power Apps (preview) |
| 21 | + |
| 22 | +[This article is pre-release documentation and is subject to change.] |
| 23 | + |
| 24 | +When writing [Power Fx](/power-platform/power-fx/overview) formulas, errors are often unavoidable. And it's time-consuming to troubleshoot and fix. Power Apps Formula repair will automatically generate and fix suggestions for you when there's a formula error. |
| 25 | + |
| 26 | +## Enable formula repair |
| 27 | + |
| 28 | +Formula repair feature is available for [canvas apps](/power-apps/maker/canvas-apps/getting-started) and [custom pages](/power-apps/maker/model-driven-apps/model-app-page-overview). |
| 29 | + |
| 30 | +Once you have Power Apps Studio open, go to the top menu bar, and select **Settings** > **Upcoming features** > **Experimental**. You'll see the toggle for **Formula repair** feature. Select the toggle to turn the feature on to experience the advantage of automatic formula checks, and suggestions. |
| 31 | + |
| 32 | +:::image type="content" source="media/formula-repair/setting.png" alt-text="Formula repair - feature."::: |
| 33 | + |
| 34 | +> [!IMPORTANT] |
| 35 | +> - This is an experimental feature. |
| 36 | +> - [!INCLUDE[cc_preview_features_definition](../../includes/cc-preview-features-definition.md)] |
| 37 | +
|
| 38 | +## Use formula repair |
| 39 | + |
| 40 | +Once you have the focus inside the formula bar, if the formula has any errors that the formula repair feature finds suggestions for, you'll see a red dot next to the **fx** icon. |
| 41 | + |
| 42 | +When you select this red dot, you'll be able to see suggested fix for your formula. After confirming the suggested change, select **Apply** to apply the change to your formula and fix the formula error. |
| 43 | + |
| 44 | +For example, the following usage shows a typo when entering the name of the label from `Label1` to `Lable1`. The formula repair feature recognizes this mistake, and suggests the change. Upon confirming and applying the change, the error is fixed. |
| 45 | + |
| 46 | +:::image type="content" source="media/formula-repair/example-repair-process.png" alt-text="Example of Label.Text."::: |
| 47 | + |
| 48 | +## Scope of error discovery and suggestions |
| 49 | + |
| 50 | +Several types of errors are discovered and suggested as a fix. |
| 51 | + |
| 52 | +1. Missing parenthesis and missing quotes. |
| 53 | + |
| 54 | +1. Typos, similar to the example for the label control shown earlier in this article. |
| 55 | + |
| 56 | +1. Misuse of delimiters and missing operators. |
| 57 | + |
| 58 | + Example of a formula using a comma (",") instead of a semicolon (";"): |
| 59 | + |
| 60 | + :::image type="content" source="media/formula-repair/submitform.png" alt-text="Example of SubmitForm."::: |
| 61 | + |
| 62 | + Example of a formula with a missed reference to a comma (","): |
| 63 | + |
| 64 | + :::image type="content" source="media/formula-repair/complex-formula.png" alt-text="Example of complex formula."::: |
| 65 | + |
| 66 | +## Limitations |
| 67 | + |
| 68 | +- Formula repair won't be able to determine the expected values when you enter a complete incorrect control name. For example, if your control name is `MyLabel` and you try to enter `WrongLabel`. In this situation, formula repair feature won't be able to determine and suggest you to use the formula to reference `MyLabel` instead of `WrongLabel`. |
| 69 | + |
| 70 | +- Formula repair won't trigger if your formula has only warnings, or isn't showing any errors (even when the formula is incorrect). |
0 commit comments