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.)

powerapps-rules-panel

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.

moon-sharepoint-list

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

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.

4

3. Next, select Define Actions. A popup box will appear. Click Let’s go.

PowerApps-defining-actions-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.

6

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.

7

5. Click Done at the bottom of the Screen and test the rules functionality.

8

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.

9

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.

10

 

Author credit: Chris Rogers

One comment

  • Greetings – I have a text field on my PowerApp and I would like to require users to enter the text in the following format, ####.####.###. I tried to right it in as Format = (DataCardValue.Text, “([en-us]), ####.####.###”) and a variety of other ways with no success. Can you how it is possible to create a rule that would require to user to enter 11 digits (treated as text is fine) with two decimals?
    Thank you!

    Like

Leave a reply or question

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s