10 PowerApps Tricks

I’ve been working with PowerApps for some time now and there are a ton of tips and tricks I’ve learned along the way. I wanted to share the things I seem to use in every single project. I also want to call out some of the lesser known tricks that are huge time savers as well as clear up a couple things that can be confusing. So let’s jump right into the list!

Set vs UpdateContext

Set creates a global variable | UpdateContext creates a local (single screen variable)
Where this can get you is if you have a duplicate, a variable that’s both global and local. PowerApps doesn’t give you an error right away, it won’t error until you completely close out of the app and reopen it, and sometimes not even then. If you’re noticing that your UpdateContext or Set is working intermittently, this is likely the case.  In #10 I’ll go into how to view your variables!

Passing Variables

Sometimes local variables need to be passed between screens that shouldn’t be global. This can be done by inserting the variable you want to create for the second page into the Navigate function like below. The variable created can be used like any other variable on the second page

Navigate(Screen2, ScreenTransition.None, {riderTeam: Gallery3.Selected.Team.Value})
Changing Icons

I love using this for two reasons.
First because you can copy an existing icon that is similar to an icon you want to create. Say someone requests adding a Back feature to an App that’s in production, simply copy an icon that has the same look and feel that you want for your refresh icon and change the icon name to Icon.Back and update the OnSelect to the reflect the new icon. 
Secondly, making the changes to the icon live to give additional feedback about what has changed. In the example below I show changing a Search icon into a Cancel icon when clicked to show that if it’s clicked again it will close the search box.
My Icon formula:

Icon: If(showSearch, Icon.Cancel, Icon.Search)
OnSelect: UpdateContext({showSearch: !showSearch})


Changing Missing Properties on Items

I ran into this when trying to set a Rich Text Editor’s border to a different color when it was disabled. To my horror, the rich text editor doesn’t the DisabledBorderColor property! If statement to the rescue. I set an If statement on the border property to change it depending on it’s where it was disabled or not. It was clean, easy. You can also other items properties or variables to change fields that “don’t exist”.

My BorderColor formula: If(Self.DisplayMode = DisplayMode.Disabled, Gray, RGBA(0, 18, 107, 1))

If you’re needing to add and remove items from collections on a single screen or throughout your App, you need to keep track. I’ll dive into more ways to view the data as it changes later, but this this is the first step. Create a label and set the .Text to be CountRows(yourCollectionName) on any screen where you’ll be adding or removing items from the collection. Keep this label up throughout development! It’s your fist indicator something is amiss and you can quickly catch any changes that effect your collection. In the example below I add all of the riders from my SharePoint list to a collection in the OnSelect of the ComboBox. You can see the number update from 0 to 24, letting me know all riders were added to the collection.

Consistent Spacing

Making your App beautiful as well as functional is pivotal to it being a success. It’s as easy as lining each item up with something else on the screen, or the screen itself! The example below shows using the label to the left to set the X for the overlapping label. You can also align things with the background canvas using Parent.

My side-by-side formula: X: Label11.X + Label11.Width + 5  |  Y: Label11.Y
Viewing Data While Using It

Being able to the view the data you are working with, while you are working with it is extremely helpful! If you’re creating new collections, you’re able to view not only the columns but the type of data it contains right from the formula bar. Like countRows this helps keep track that the App is manipulating the data the as expected.

Creating Collections

Using collections allows for not only faster query times but it decreases the amount of filters you need throughout your App. When creating each collection you are able to select a subset of the original data that we can more easily manage and use. In the example below I show creating a new collection using my original SharePoint list to get a list of just the birthdays of the riders.

Formatting in the Formula Bar

Just like the above solution this will help keep the formula from being deleted my accident, hitting shift + enter also takes you to the next line. I use this often when commenting out sections so I can jump to the next line and continue working.
There is also an option to Format text just under the formula bar itself. If your formula is longer than a few lines it can be difficult to find any specific portion to make changes or updates, but format text makes the code much more readable.  

Viewing Collections and Variables

Collections: view all collections you have in the PowerApp and the details about the data in the collection
Variables: you are able to see loads of information about your variables such as where and how it’s used
Again, seeing what your data is, where it is, and how it’s being used is immensely valuable! Knowing if something is stored as a table or record lets you know how you can use the information. The same is goes for viewing the variables, maybe someone on the team set a duplicate variable, both global and local, being able to view the variables and so much information about how they’re used will help clean those bugs right up!

Code Editor for Long or Complicated Formulas

As I mentioned before, PowerApps undo feature is a little lacking and can make changes and updates to working formulas very stressful. I’ve started coping out my formula and making my changes in VS Code, but anything like that or NotePad++ will give you the ability to view the formula with the correct formatting and gives you the peace of mind of knowing you and ctrl + z if you make a mistake. 

I hope you’ve enjoyed and learned something! Please let me know if you have any questions or have something you’d like covered.

Sam Collins

Sam Collins

With more than 10 years Sam's focus is on not only providing solutions that work but ensuring that the solution is liked and accepted at the user level. With a passion for doing things the right way, Sam has developed a set of special skills that get executives what they want while keeping the users enthusiastic.

YouTube Channel

Need help with your PowerApp?

Schedule a chat so we talk about your app!

Leave a Reply

Your email address will not be published. Required fields are marked *