This post describes how to show or hide fields based on a choice column from a SharePoint list in Power Apps.
I was recently working on a Power App form for new site/ teams requests. The fields were all based on SharePoint list columns and one of the key fields was a choice column. What I wanted to do was have an additional field default to being hidden from the screen unless a particular choice value was selected.
Now I’ve used the Microsoft guidance to create dependant drop-downs before but this scenario was slightly different and it was based on a choice column which isn’t compatible to my knowledge. I’d done something before in my Power App to toggle the display mode of a button in my app if fields are blank. So starting with this I used a simple if function in my formula to show/ hide my field based on the selected choice value.
Here’s how to hide a field based on a choice value in Power Apps:
Open your Power App to edit it > ensure both the choice field and the field you want to hide are added to the screen
Select the data card for the field you want to hide until a choice value is selected
In the top, left-hand corner of the Power Apps editor, select the visible property
Add the following if statement to the formula bar, replacing the parts highlighted below:
This is the final part in my fun with PowerApps series, in this post i’ll go through the steps involved in creating a new PowerApp from scratch and highlight some of the difference with using a template or generating a PowerApp from a SharePoint list.
You can read all the other parts in this series below:
So far we have generated our very first powerapp from a SharePoint list or library, but now we want to take it a step further and create a brand new PowerApp from the beginning to enable us to create a desktop experience.
To create the bespoke PowerApp we will need to begin in the PowerApps studio, the steps below walk through creating the bespoke PowerApp:
In the Home screen, select Start from blank – make sure the desktop view is selected – Press Make this app
The PowerApps studio will give you some useful tips on how to create forms or galleries which are definitely worth checking out if you haven’t already!
On the canvas, press Connect to data
In the Data window, select the data connection we created earlier
Enter the URL of the SharePoint site you want to access
Once entered, you will see all the available lists and libraries you can use as the primary data source, select the one you wish to use
And there you are your custom PowerApp is all set up and ready to go! Of course this is just the very beginning and you now have the fun bits to come like adding all of the elements that will make up your PowerApp but from my experience I think there are a few approaches to achieve this.
My idea was to create and open up the template helpdesk PowerApp side-by-side with my custom one to get a better understanding of how to re-produce things like the totals across the top and some of the finer details that make up the PowerApp. I think doing it this way is much easier than trying to pick apart the templates as you are starting with your own data source rather than the static ones provided within the templates.
As well as the desktop and mobile experiences you now have the ability to create list forms using PowerApps too, so now there is even more fun to be had with PowerApps!
Carrying on from my last post – creating a data connection, we are now good to go and begin to build our first PowerApp!
Just like setting up the data connection, creating a PowerApp can be a really simple thing to do.
However, I’ve found either creating a PowerApp from the SharePoint list or library is really quick and easy, but it doesn’t necessarily give you the most flexibility when it comes to wanting to do it your own way…
Creating a PowerApp
You can create a PowerApp from a list or library literally from the push of a button! Its as simple as:
Create your list or library, add all the associated columns and data you wish to be displayed in your PowerApp
Press the ‘PowerApps’ button on the list menu, then press ‘Create an app’
You’ll then be prompted to create your app, start by giving it a name and press ‘Create’
After a few moments your app will be created! It will open in the PowerApps web editor and you should see your list columns and data displaying in your shiny new PowerApp!
You can also take a look at the app in the preview to get a good look at how it operates and how the data is displayed…
That’s it! Your all set…but if you’re like me you’ll have some questions. Like, what if I want a desktop app and not a mobile one?
Well for that you’ll need to build an app from scratch, I’ll be going over creating a new PowerApp in the next part of this series so hold on as i’ll be posted the next part very soon!
Continuing on from my previous post – setting up the default gateway, we should now be in a position to create a new data connection within PowerApps. On the surface this is pretty easy to do, all that’s needed is to choose the connection type – press create – authenticate – job done!
However, when we need to create a data connection for an on premise SharePoint environment, its a little bit of a different story. Here are the steps involved for setting up a new data connection for a SharePoint on premise environment:
In the search bar, search for “SharePoint” – press the plus icon
The SharePoint data connection popup box should appear, under “how do you want to connect to your data?” select Connect using on-premises data gateway
Set the authentication type to Windows and then specify your username and password (you may need to include a domain name as part of the username)
I used credentials of a user that had owner permissions for the SharePoint environment I connected to, it makes sense to me that the account you specify here would at the very least need to be able to read/write to the SharePoint list that acts as the data source.
Choose the gateway we set up in part 1 of this series, if you can’t see it you might need to install it again or refresh the list until it displays.
I actually had to create the default gateway using a different account than the one I created my first PowerApp with, so it wouldn’t show for me initially. I had to share the gateway I created and set my PowerApps user as an admin for it to show in this list.
You will now see your newly created data connection appearing in the connections list! Your able to edit and delete the data connection at any point and can also check who the owner is, the connection name and crucially the status of the connection under the details button.
There is also this article from Microsoft talking through connecting to SharePoint from PowerApps that lists the known issues with certain column types:
I’ve recently been playing with PowerApps for the first time, I set myself a challenge of creating an IT service desk in PowerApps using a SharePoint 2016 on premise environment as the main data source.
So before I start going through all the steps I found were needed for me to setup the default gateway, this article from Microsoft is a great place to start and contains most of the steps I’ll go through below: