Chapter 1: Building pixel-perfect solutions with Canvas Power Apps
Power Apps is the platform of choice for building business solutions using a low-code method. This approach enables the rise of the citizen developer, a being inside every organization who is keen on learning technology, which also brings the expertise of the business process to which this person belongs.
One of its versions, canvas Power Apps, allows the creation of pixel-perfect implementations of user interfaces. As its name suggests, it brings a variety of tools to build any imaginable design into your applications. Whether it's a critical business application or a mobile tracking system, canvas apps gives you all the tools required to design your app.
During this chapter, we will discover how to create a sample of real-life applications that will give you an insight into different approaches when building canvas applications: standalone and embedded Power Apps. We will also learn how to set up different types of data sources for our applications.
This chapter consists of the following recipes:
- Discovering best practices when building canvas apps
- Creating an incident tracking solution – Setting up the data source
- Creating an incident tracking solution – Building the user interface
- Embedding an expense tracking list with SharePoint list Power Apps
- Creating a Power App from existing data
Discovering best practices when building canvas apps
Setting up data sources, defining business process flows, creating user interfaces; all these tasks are pieces of an application building process. These pieces come together to accomplish the main goal: to build a solution that solves a specific need.
One of the things that you need to consider is the maintainability of your app. Whether you are in charge of fixing bugs or adding new features in the future, using best practices is always a good idea. No matter the technology you are using, well-documented code is easier to maintain.
Even though Power Apps is a low-code platform, you need to consider certain things before you start building applications. Like any other developer team, you need to establish code standards. These standards allow your team to be more productive by setting predefined patterns for variable naming, control usage, and coding methodology.
Variable naming
Proper naming gives your developers instant insight into the scope of your variables. For example, if a variable name prefix starts with lcl (short for local), it means it's value will only be available on the current screen. On the other hand, using gbl (short for global) means that this variable is accessible across the whole application.
These examples might seem trivial, but if another developer needs to maintain your app or if your app serves as a template for other apps in your organization, setting these patterns from the start can help the app building and maintaining process.
Control usage
One of the vital elements of an application's success is performance. If an application is slow to start or takes several seconds to perform a task, it hurts user adoption.
Here are a few examples of this:
- Having a great-looking app using many controls to build its user interface but hurting performance each time the screens get rendered.
- Displaying data to the user using a gallery inside a gallery. This approach might be tempting to present master-detail data, but this would be a significant slowdown in your application.
To avoid this, you need to learn the performance points of your platform. In Power Apps, one of the main recommendations for improving responsiveness is to reduce the number of controls.
Coding methodology
This concept describes a set of rules to regulate the application building process in a low-code team. Your solution infrastructure can also help you make an informed decision on how to build your application:
- If you have data that rarely changes, you can create collections on application start to avoid round-trips each time data is required. Even more, if you have data that never changes, you can import this as static data inside your app for speedier access.
- Taking advantage of the features available in your data source can significantly improve your application building process and even its performance. For example, when using Dataverse or a relational database, there is a significant difference when querying data if you use a data source view instead of building the actual query in your application logic, especially if it needs complex relationships. Using these views gives you cleaner code while also improving performance. This improvement relays on the data source engine as it is the one that executes the data processing instead of the Power App.
These are examples of practices you can coordinate with your team when building apps. For a detailed list of best practices, please refer to ht...