PowerApps Rules Panel
Just two days ago, I virtually did a presentation at the DFW SharePoint user group meeting. I went through various terminology in PowerApps, and how to translate the way we did things in InfoPath, to how it’s done in PowerApps. One of the things that I mentioned, was that conditional formatting is still pretty complicated, because it needs to be done by writing a function similar to an Excel IF formula. Today, Microsoft has released a new PowerApps feature that takes aim at simplifying conditional formatting. The added ability to create rules for controls, allows new PowerApp users (especially non-technical business users) to quickly integrate conditional formatting into their budding projects. It also gives PowerApp veterans the option of saving some valuable time.
The addition of rules has also brought about a modification to the User Interface. It seems the Data Tab has been usurped by the Rules Tab. (For controls that require Data Connection information, you now select the Properties tab and click the Data link at the top of the display.)
Let’s take a quick look at the basic function of this new feature.
In the PowerApp below, we are populating a data table with a SharePoint List. This list contains various pieces of data about our Solar System. For our project, we would like to use conditional formatting to show/hide the List Moons button. The visibility of the List moons button will be based on the existence of moons for the selected planet.
1. Start by selecting the List Moons Button and selecting the Rules tab. Select + New Rule. When + New Rule is selected, a window will appear that allows the configuration of Conditions and Actions.
2. Select Add a Condition and then choose Equal to. An input box will appear and allow us to set the condition. In this example, we will check to see if the planet, selected in the data table, has zero moons.
3. Next, select Define Actions. A popup box will appear. Click Let’s go.
The popup will disappear and then we are presented with the PowerApps Edit screen again. However, there is a message at the top notifying that subsequent actions will be recorded as actions to perform upon meeting the conditions of the current rule. Notice the List Moons button’s current visibility is set to On. This reminds me of when you record a Macro in other MS Office programs.
4. Set the Visible setting to off and select Done in the message displayed at the top of the window. By clicking Done, this will cease the current rule configuration from capturing any more Actions. Under Actions, the previous change made to the button’s visibility is now recorded.
5. Click Done at the bottom of the Screen and test the rules functionality.
When Mercury is selected, our Rule will check the number of moons. When the previously set condition evaluates as true due to Mercury having zero moons, the Action is performed and the List moons button is hidden.
Now, let’s select the Earth. Our rule now evaluates to false, since the earth does have a moon, and the list moons button reappears on the screen.
Author credit: Chris Rogers