There are few products within the Microsoft Power Platform lineup that are as flexible (or as frustrating) as Canvas Apps. While Canvas Apps allow you to create almost any interface or navigation path you could possibly want, they can also come with some of the most vague and unhelpful errors imaginable. We would like to kick off a series discussing how to debug such issues within Canvas Apps, beginning with fixing formula errors of an app.
Something that we frequently use formulas for is the visibility of controls or the conditional formatting of text within Canvas Apps. Depending on how many conditions you may want to use as a criterion for this logic, these formulas can become complicated very quickly. Additionally, the normal interface can leave a bit to be desired when it comes to readability. Take the following screenshot as an example:
If you have not done a lot of Canvas Apps, an error like “Invalid number of arguments” probably does not immediately read like something that says “you forgot to close a parentheses”, does it? Furthermore, clicking into the “View Problems” link does not direct you to where the issue actually is. So, how do we debug this?
First, take a close look at your formula for things like missing parenthesis or commas. Clicking on a parenthesis in the formula bar can help with this process since the formula bar will highlight its matched pair within the formula. In this case, we can see that the Is Blank function that is checking the value of txt_LumpSum1Payment is not being closed off where it should be, so adding a parenthesis will resolve the issue. See below.
Something to get into the habit of doing is using the “Format Text” button at the bottom of the formula bar. While writing formulas in this manner does convert your text, it also takes up a more space on the screen. This will make spotting errors significantly easier than it is with potentially several nested formulas crammed together into one or two lines of text.
For the most part, issues with formulas come down to missing elements from a formula such as commas and parentheses. While there are tools to help debug these issues, like IntelliSense and highlights for parentheses, it is not always obvious how they can be used. Hopefully you found this article useful and we look forward to our next one about Monitor and Canvas Apps.