This post will introduce you to some basic conditional formatting, rules & validation ideas you can implement today in your customized SharePoint forms using PowerApps. And don’t worry – if you start making changes to your form and don’t want to keep them, you can easily switch back to the original SharePoint form.
Basics
Always know the name of what you’re referring to. Click on any part of your form to see the name of that specific component/control in multiple places as illustrated below.
See below for the anatomy of a field being customized in PowerApps. Generally each card holds a field (name/key) and you enter (and likely make your rules/conditions on) values.
You’ll use these names in formulas.
When referring to a text or number field, you can generally just use the value name (DataCardValue1>=100) but a choice field, date field, or anything requiring selection would be referred to something like DataCardValue1.Selection.Value1=”Professional Development”. This article on docs.microsoft.com is a great place to learn some basics with formulas, and I’ve included some specific ideas below that I’ll demonstrate further down in my example form:
Formatting/Basics |
|
Text(DataCardValue…) -OR- DataCardValue.Text | Format number as text |
Value(DataCardValue…) -OR- DataCardValue.Value | Format text as number |
&& | Insert multiple conditions in a rule (This && That) |
Visible=false -OR- Visible=true | Hide (or show) a field (such as if a certain choice field selection is made, hide an unrelated field) |
DataCardValue1.Selected.Value1=”Choice Name” | Using choice field selection in formula |
Math |
|
Sum(DataCardValue1, DataCardValue2) | Sum/Addition |
DateDiff(DataCardValue1.SelectedDate,DataCardValue2.SelectedDate) | Get difference between two dates in “days.” DateDiff(Start,End) |
Conditional Formatting & Dynamic Calculations |
|
Concatenate(“Trip duration: “,Text(Sum(DateDiff(DataCardValue2.SelectedDate,DataCardValue3.SelectedDate),1)),” days”) | Show length of trip once dates are entered (Trip duration: # days) |
Concatenate(“Total: $”,Text(Sum(DataCardValue6,DataCardValue5,DataCardValue4))) | “Live” totaling (Total: $####) |
DataCardValue3>1/1/1899 && DataCardValue3<DataCardValue2 | Condition for highlighting end date if less than start date. Waits until dates have both been entered before applying warning formatting. |
Rules |
|
DataCardValue3>1/1/1899 && DataCardValue2>1/1/1899 | Hides “trip duration” until both dates entered |
DataCardValue7.Selected.Value1=”Miller Award” && Value(DataCardValue6.Text)>50 | If certain choice selected, warns value can’t be more than 50 for certain field |
Sum(DataCardValue4,DataCardValue5,DataCardValue6)>1000 && DataCardValue7.Selected.Value1=”Professional Development” | Warns if total exceeds certain amount based on choice field |
See my video below to see each of these put into use for a travel request form.
To get started:
- Make sure your list is in modern view.
- Click PowerApps –> Customize forms OR Click “New” and “Customize”
- You may be asked to sign in.
Can you provide a clue on how to validate if a value in a fied isn’t unique across the list?