PowerApps Newbie – home screen

This is post 3 in my series, but it’s the first post where I’m starting to document actual work in PowerApps. Today I have simply started to create the shell of my new app “My Golf Stats” as well as start to get the data layout for what I envision in Excel. This post will just be about the app shell and I’ll dig into the Excel part later.

Previous Posts

The background and previous posts in this series can be found here:

  1. Introduction to my series
  2. Project background – what I’m aiming to accomplish

Creating the app

The first step, walking from the very beginning, is creating the app. I’ve already registered for the community plan in post #1. I log into my environment, being careful to choose the free plan not my Office 365 plan (“Jen Kuntz’s Environment” is the free plan).

In the navigation bar, I click on Apps to start (although there was an option under Home as well I could have clicked on), and click on “Create an app”. In this environment, it’s a blank slate, nothing exists yet!

The first choice to make is whether I want to create an app based on a template or from scratch (blank), and the default screen size. There are tons of great templates if someone wanted to start from a different spot in learning PowerApps, to see how something pre-existing works together and was built. For my purposes though, I want to start from scratch so I chose Blank app. In this case, my intent would be to log stats from the golf course or worse case, shortly after a round, so I am opting for a Phone layout. I may revisit later as Tablet would be nicer to view stats and scores after the fact. I may simply create a second app down the road to handle more analysis and graphics in that format.

Building the “main screen”

The first thing I did was set the background colour to the same blue I use on my website, a dark navy. I brought in a graphic, which in hindsight looks a little “my first website” circa 1990 (you’ll see in the end result below!), but it will do for now. I put a label on for the name of my app and dragged 3 buttons onto the screen.

I believe in following best practices wherever I can, so in keeping with that, I’m planning on renaming the elements of the screens I build and leaving nothing with the default names like button1, button2 etc. It may seem like a small thing now but later on, it will be easier to find things plus figure out what does what. The screenshot above shows my first screen is now called “MainScreen”, has 3 buttons with appropriate names for the functions I have to start, and the AppName label and AppIcon image. Any objects which I think I’ll reference in code, like buttons, I’m planning to name as if I would in any other development environment.

First piece of code: the Exit button

When I did a very basic initial test of my first app prior to starting this project, I realized that the only way to exit your app in PowerApps and get back to the list of apps was to swipe right to close the app. That’s not super intuitive to me, so I created an actual button in my application to exit the app instead. This is the simplest of all code, so it’s the first thing I did.

On the Exit button, the code is simply “Exit()” for the OnSelect action. Technically you could also put in “Exit(True)” but the true is implied from what I read so it seems to be unnecessary.

One thing to note is you can’t test the Exit function in the app design “runtime” mode because the app isn’t actually running. I thought I was doing something incorrectly until I googled the issue and found the little tidbit that says you need to be actually running your app fully to test that. So, I published the app, and sure enough, the code worked!

Sneak Peak – running the app

I have not yet connected the app to data yet as I want to model the structure in Excel first, but I can test what I’ve done so far. I opened PowerApps on my phone, logged into my account and sure enough, the My Golf Stats app was there. Loading it looks like this:

… and here’s the running app!

 

That’s it for now. The subject of my next post will be about planning how I want the data modelled to capture what I want, in Excel. I’ve started with the easy stuff that I had already done earlier – a list of courses – and have added a list of countries I’ve played golf in so far and list of states & provinces in those countries, since one of the first things I want to do is be selecting data from a list or lookup, to have “good” data in my tracker from the start. I have more modelling to do on the rest before I’m ready to write about that!

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to top