PowerApps is a platform for creating a custom business application for someone with very little hardcode coding skilling. It creates an application so fast that you end up having a lot of spare time. And what do you do when you have a few hours to space? You end up creating another application, just for fun. What better than create a simple game and explore the possibilities that PowerApps can do. So you can do Game Development or Animation in PowerApps.
Though PowerApps is not something you create a game with and it was never envisioned to do so. An actual software to create games should be able to provide an easy way to animate, loop, and trigger changes. Technically, we don’t have a direct feature to do that in PowerApps but we have an amazing thing called Timer control. Timer Control generates a continuous value that increases with time. This value can be mapped with the values of other objects in the PowerApp and you end up with animating objects in PowerApp.
The first try, that I did with PowerApps was creating Flappy Bird. For creating a Flappy bird you will have the following objects in the canvas.
Bird,
Pipes, and
Background
Download these gif images of these objects from the internet place it on the canvas. Additionally, you would need :
Text to show scores
Text to show Game Over
A restart button
A jump button
The Animation:
The animation happens by changing the x-y coordinates based on Timer Control.
I initiated three variables: ‘varTimer’ to start and stop the timer. varJumpValue which is used in bird object to jump and TimerValue which is updated from the timer.
The timer duration is set to 10ms. After 10ms the timer restarts and OnTimerStart TimerValue is increased. The same time we do the collision test to check if the bird has collided with the pipes.
When the Timer starts rolling, TimerValue subtracted with varJumpValue is updated which is bind to the Y position of the bird. This will keep the bird move down with the increase in TimerValue while the varJumpValue helps to make the bird jump.
When Up Button is clicked, the varJumpValue is increased that makes the bird jump.
To keep the background moving, You can add the value of Timer control to the X position of the background and it starts moving.
The pipes will also start moving with the TimerValue from right to left. Once, the pipes are out of the frames, it will move back to the original position.
Now, you have a jumping bird, moving background and moving pipes.
Collision Test:
To check if it collides with the pipe or goes through the narrow passage or not. You can calculate it with the normal linear function.
With same collision logic and changing the positions of the objects based on the timer, ended up making another simple game I called it Superman vs Darkseid.
In this article, we are going to discuss PowerApps Connectors which is one of the core components of Microsoft PowerAutomate, aka. Microsoft Flow because it allows your flow to connect with the systems within and beyond the Microsoft tenant. As a result, you can quickly develop processes that span all your systems. Thus, it allows you to automate your job. Moreover, Microsoft has a vast range of connectors – Standard, Premium, and Custom Connectors in Power Platform.
Standard Connectors
In brief, Standard Connectors are connectors that are open for use in all the licensing plans of PowerApps. We can efficiently utilize Standard Connectors in Power Automate, Logic Apps, and anything we create in PowerApps because they are available to use all across the Microsoft Power Platform
So, Standard connectors cover the most commonly used data sources like SharePoint, OneDrive, and even third-party data sources such as Google Drive, Twitter, Github, etc.
Premium Connectors
Likewise, the Premium connector is only available if you subscribe to Premium Licence Plan. Premium connectors and Standard both work out of the box without any further configuration. Premium connectors mostly cover external applications such as Salesforce, DocuSign, Survey Monkey, Amazon, and so on. Moreover, The premium connectors are identified by the Premium Stamp.
Custom Connectors
Basically, Custom Connectors are used to connect with external web services. So, you can access, modify data in external systems with PowerApps via Custom connectors. As a result, When we register a custom connector, we configure the web service’s characteristics, including the authentication it requires, the triggers and actions that it supports, and the parameters and outputs for each of those actions.
So, if you want to learn how to Register and use custom connectors then you can follow the tutorial below. Afterward, you register your custom connector, you can share it within your organization for testing.
Also, you can have your connector as an Out-of-the-box product for all users by registering it in PowerPlatform. ( documentation here )
In conclusion, check out the differences between all three PowerApps Connectors in nutshell in below.
Differences between PowerApps Connectors
Standard
Premium
Custom
Purpose
Connect with services within or beyond Microsoft.
Connect with services within or beyond Microsoft.
Connect with external web services not available in the Microsoft connector list.
Licenses
Available in all the licenses.
Only available in Premium PowerApps license.
Available in all the licenses.
Configuration
No configuration required.
No configuration required.
Configuration required like authentication, actions, parameters to be passed etc.
I have found PowerApps Developers struggling big time after having crucial apps deployed to the default environment. Obviously it seems like a default production environment. Since there is minimal documentation on the PowerApps Default Environment, most of us do the mistake of using the default environment for production apps or business-critical apps. The documentation around the default environment is spread across different places in Microsoft documentation limbo. So, here is in a nutshell what’s default environment and why not to use it for production.
What is the default environment?
A default environment is a particular type of production environment. Each tenant has a default environment that’s created automatically. For each tenant, a default environment is automatically created by Power Apps, which is shared by all users. Whenever a new user signs up for Power Apps, they’re automatically added to the Maker role of the default environment. So it is seen as a public environment of your tenant.
Why not use the default environment for production?
You can’t backup and restore the default environment.
The default environment is limited to 32 GB of storage capacity. In case you need to store more data, you can create a production environment.
Helps to segregate data and apps so that other environments can not use them.
Everyone in your tenant has permissions to create apps and flows in default. There currently is no way to block the Environment Maker role assignment in the Default environment.
Non-default environments offer more control around permissions.
What’s the use of the default environment then?
It is used the environment as a user and team productivity environment for the business groups, not business-important or mission-critical apps. Hence it is recommended to rename the environment through the admin center to make the purpose of that environment self-explanatory.
This environment is used for first-party integrations, like creating an app from a SharePoint list. Learn more: The default environment. Thus, This environment can’t be disabled or deleted because it hosts integration with products like SharePoint and Project.
Many of us can identify with this situation when you are in the middle of something and the internet goes off. The Internet can be flakey or unavailable.
Internet connection is like Catwoman charming but a duplicitous double-crossing rogue who will leave you alone at the most vulnerable state. We all have a moment when we are deceived by our internet connection, the same way when Catwoman led Batman into Bane’s trap; poor chap broke his back!
TL;DR: In this blog, you will learn the basic concepts of creating an offline app in PowerApps. Because the internet is flaky, you’ll always need to consider that an app works when there is no network.
Introduction
PowerApps is a low code cloud-based platform. If you want to know more about PowerApps, here’s a short video.
A while ago, we were working on an app on PowerApps for the enabled users to collect field inspection details. A canvas based PowerApps was an excellent solution. However, the end user had to work in an area which might not have internet connectivity. We need to make an app that works in offline too.
I had my doubts initially. Gladly, I was wrong. A lesson learned. An app platform with Power in its name should be powerful enough to do anything.
Now, the question is how does PowerApps work offline?
In PowerApps, follow these simple steps for making the app work offline:
When the app loads or when a specific action is triggered, check whether there is a connectivity or not.
If there is connectivity, use connectors and directly take the data from the source in the cloud.
If there is no connectivity, save the save the data into the collection and leverage the power of `SaveData` to store locally in cache file or LoadData to fetch from locally stored data. Once there is internet connectivity, the locally stored records are stored in the data source.
To implement offline compatibility in an app you’ll need formulas below:
Collect, Clear, and ClearCollect functions in PowerApps
SaveData and LoadData
Connection
Patch
Collect, Clear and ClearCollect function Collect is used to add records to a data source.
Syntax:
Collect( DataSource, Item, … )
Clear is used to delete records from a collection.
Syntax:
Clear( Collection )
ClearCollect is used to add fresh records to a collection by clearing all the previous records.
ClearCollect( Collection, Item, … )
Note that Clear and ClearCollect can only be applied to collections and not other data sources.
So what is a Collection?
A collection is a group of items that are similar. It is used to store the records so that it can be used in the app. For example, SuperHeroes is a collection that stores the name, planet, and girlfriend of superheroes.
LoadData and SaveData are the only functions that allow you to store and use dynamic content locally on a device. These two functions are also always suggested when people ask how they can get their apps to work offline.
Syntax:
SaveData( Collection, Name )LoadData( Collection, Name)
Connection
The Connection signal returns the information about the network connection. When on a metered connection, you may want to limit how much data you send or receive over the network.
Syntax:
Connection.Connected //returns true if internet is connectedConnection.Metered //returns false if internet is not connected
Patch
Patch function is used to modify or create a record in a data source.
To show a list of records, the app should be connected to the internet at least once. We load the records from the data source into the collection and save the records from the collection in a local cache file. If there is no internet connectivity, then we will be using the locally stored data and load it into the collection.
The records collection can be used as a source of records in the application. You can use it as the data source for gallery control or any other control.
Scenario 2: Add / Update Records
Keep in mind, the following points while adding or updating the record:
Save all the records in the local cache when the internet is connected.
If internet connection is available, save/update to the Data source directly else, save or update in the local cache
Keep a flag in the collection to mark whether the record is a new record or the updated record
Once the internet is available, iterate each record of the collections
If the record is flagged as new, add it into the data source
If the record is flagged as updated, update the respective record in the data source
Example:
We have a SQL database called Pokemon, and it has two columns Name and Ability.
We are adding the record of Pokemon to DataSource Pokemon if there is connectivity otherwise storing it into the local cache file keeping a flag “New”.
We are updating the record in the data source Pokemon if there is connectivity otherwise update in the local cache file. Here we are updating only ability searching the record from Pokemon’s name.
While synching the offline cache with the data source we are checking the flag whether it is a new record or updated record. If it is an updated record we are updating in the original data source.
The synchronization code can be triggered when a screen loads, a button is clicked, or using a timer and syncing after a certain interval of time checking the internet connectivity.
Conclusion
In this blog, I showed you how you could make PowerApps work. You can try these simple methods to build your next offline first PowerApp. If you need help, do not hesitate to leave a message in the comments section down below. Cheers!