Power App Canvas: How best to start a new project

Starting a new project requires a quiet moment, carving out a moment of solitude and writing down on paper the requirements for how best to approach a new project.

A Low-Code project cannot exempt itself from this preliminary analysis, which if not done carefully can result in project failure.

For this reason, I thought I would give birth to this article, with the goal of sharing with you what for me are the necessary considerations to best approach a new PowerApps Canvas project

At the end of this article you will also find a list of supporting documents.

The same methods and considerations that I will reveal in a moment may also come in handy if your project is in progress.

Let’s get started !

Whether you are developing a code-based app or a no-code or low-code app, one of the things you must always consider is the maintainability of your app. 

Regardless of the technology you are using, well-documented code is the best tool to make it easier to maintain your canvas app.

Even though Power Apps is a low-code platform, you need to establish some code standards that will allow your team to be more productive.

First among the standards I recommend you adopt is variable naming.

This approach gives you a snapshot view of the scope of the variables you are using.

For example, if you use lcl (short for local) as a variable name prefix, it means that its value will only be available in the current screen. On the other hand, using gbl (short for global) means that this variable will be accessible in the entire application

To define a global varible you will have to use the Set() function, while to define a local variable you can use the UpdateContext() function. In addition to these two types I recommend you also use the With() function, which allows you to define a variable in the context of the function.

To learn more about standards, I suggest you also read the white paper shared by the community. 

Inside you will find other tips to follow to make your application more maintainable..

Using proper naming is just the first of the necessary building blocks to consider for your canvas app.

Alas keeping your code and app structure clean and well organized will not be enough to determine the success of your project!

The second and most important of the elements you must always have in mind is performance. 

You must always consider that if an app is slow to start or takes several seconds to execute a task, it will hurt user adoption. 

But how do you avoid this?

For a Power Apps Canvas one of the main recommendations for improving performance is to reduce the number of controls used because they might impact in negative manners when screens are rendered.

For example, if you are planning to manage data visualization using one gallery within another well know that this will result in a significant slowdown of your application. 

However, it is not only the reduction in the number of controls that will impact performance but you will necessarily have to pay attention to the calls you are going to make to get the data you need.

Try early on to be clear about how your data changes within your app and try to reduce the number of calls you make to get it.

If you have data that changes infrequently you can create collections at application startup by taking advantage of the OnStart() function. 

Beyond that you need to be clear about how the data propagates to the components or to your screens. 

In the case where your application becomes much more substantial, with, for example, 15 screens and with many component libraries within it you will need to have a map that encapsulates all the information.

Build yourself some sort of local store to simplify communication between any component in the application and avoid repeated calls to already get a known piece of information.

 

This technique is even more efficient if you have data that does not change frequently.

To create your own store you only need to instantiate a record preferably in the OnStart and have to worry about updating it when one of its properties is changed.

Although the local store sounds very seductive try to limit caching of data.

As you can appreciate after these initial considerations, data plays a significant role within the application. 

However, making assessments only on its management is not enough. 

In fact, you will also have to ask yourself how to obtain the information that will power your application.

A Power Apps Canvas can boast the ability to use connectors that allow you to connect to different data sources.

Among the most popular standard connectors,you can find Dataverse, SharePoint, Excel etc..

You might think, “great, I’ll add the SharePoint connector to my powerapps, do a GET and put the whole list in a Gallery. Simple!!! “

WAIT

Always keep in mind that there is a limit of 2000 records for a Canvas app. 

Also, bringing 2000 records locally will weigh down your application considerably, and applying filters to this list will not be a straightforward task.

Therefore you cannot neglect Delegation, it is critical to manage the performance of your application.

Delegation is really about asking our datasource to execute the query that I am creating.

So properly this means that you are asking the datasource to retrieve the data via the requested function.

This allows us to make Power Apps and the datasource work with a strong synergy.

However, not all functions are delegable and especially not all data sources allow you to delegate your requests.

When we talk about functions that cannot be delegated, it means that the data source is unable to execute the function you requested, trivially the distint() or the group by of SQL.

So in this case you will first have to retrieve the data, bring it local to the power apps, and then apply distint().

data sources found to be delegable are Dataverse, SharePoint, and SQL.

 

You may get the urge to use Excel’s “magnificent” connector to interface with a sheet and be able to easily edit it from your Power Apps Canvas

ALT! Don’t do it.

The Excel connector has many limitations.

The first among them is that it does not support Delegation, so your queries cannot be delegated.

 

In addition to this you will have to have your document uploaded to OneDrive, the file has to be formatted as a table, there can be no formulas, you cannot enter write to the document if a user already has the document open, and it undoubtedly takes longer to write a record than sharepoint or dataverse.

Therefore, if you are developing a simple application you could take advantage of SharePoint lists to repurpose your Excel sheet.

As an advantage SharePoint allows you to delegate your queries, making it much more scalable than an Excel file. Also you can use the SharePoint connector with non-premium licenses.

However, it is necessary to point out that SharePoint is not a database!

Keep this factor in mind because I don’t think your intent is to one day end up with an application that explodes in your hands.

In that case, if you have a need to organize data in a more structured, relational way, I recommend that you consider integration with Dataverse. 

Microsoft Dataverse is the data and services platform for Dynamics 365 and the Power Platform.

Its adoption enables the developer to speed up and simplify database administration tasks.

If you want to learn more about Dataverse, I’ve prepared an article where I explain what’s behind the scenes and why you should use it.

Great, we have seen how to manage and how to retrieve data. But there is one more “small” consideration that should not be overlooked.

Take into consideration the number of users !

It is crucial to avoid getting hurt when working especially on apps commissioned by clients because maybe you don’t have the same amount of data.

You need to know at least an estimate of how many users will go to use the app, this is because the use of the connector in app may go to overload the connections we have per minute.

For example sharepoint gives us 600 connections per minute which means that if before the minute you saturate those connections then you will have to wait for that treshold to be renewed.

What else is there to know?

Here by now you’ve learned what the basic info is for structuring a Canvas power apps application, you’ve seen what functions can be delegated, and the considerations for choosing the right data source.

You’re ready to go but … BOOM!

Your application doesn’t appear to be accessible.

The issue related to accessibility must be attacked from the very beginning . 

Accessibility is not a plus, and therefore you must prepare yourself to develop an application that is usable by users with disabilities such as: Low Vision, Blindness, Deafness, Motor Difficulty, Comprehension Difficulty.

WCAG 2.1 ( Web Content Accessibility Guidelinse) outlines the guidelines for web content accessibility.

Some of the best practices you will need to consider are :

  • ensure that the elements on the page are navigable from the keyboard
  • use legible fonts
  • manage contrast between text and background
  • describe images and transcripts thoroughly
  • describe images and transcripts thoroughly
  • manage accessible labels correctly
  • consulting the Accessibility checker alone is not enough, but it still gives a good starting point

What we need to know, however, is that structuring accessibility for a Power Apps Canvas application will not be the same as defining it for a traditional WebApp. 

We cannot access the HTML attributes. This is because the code, in addition to being auto-generated, is also grafted inside an IFrame on the page.

Therefore, in borderline situations you will have to adopt alternative solutions.

One of these is to consider developing your components by taking advantage of the PowerApps Component Framework (PCF).

The PCF allows you to develop code-based components to enhance the user experience.

Here is a link to PCF GALLERY, the community-supported page where you can find several ideas for your components.

Try to dose this possibility well. 

First, because this development will require you to manage the component in the future, paying close attention to the continuous platform releases.

But most importantly if you started developing everything custom you would lose most of the advantages of the low-code platform so try to manage this option well.

Below are some links you can use as a supplement to this article: