Introduction
User experience is a key factor for any application. It can lead to a much better user adoption. One such example is showing zero state. For example, when a users accesses an app for the first time, it is a good idea to show some zero state message. This helps the user know that the app is working fine, its just that there is no data to be displayed yet. Similarly, if there are no results in a gallery for a given search criteria, a message telling the user that the search resulted in no results makes for a better experience.
Tip - Zero state images!
There are multiple ways you can add zero state messages. They can be as simple as text on a label. But if you want to get fancy, you can add some cool images. Irrespective of whether you use labels or images, the idea is to conditionally show them based on the number of records in the datasource or the gallery.
The sample apps for Dataverse for Teams use this approach a lot. I will use the Milestones app, my personal favorite, to illustrate the concept here.
If a project doesn't have any work items, we show the following zero state illustration:
The Visible property of the image and label are set to:
CountRows(gblProject.'Project Work Items') = 0
where gblProject is a variable in which the selected project is stored.
If a gallery is blank simply because of a particular search criteria, then we show the following illustration:
In this case, the Visible property is simply set to
CountRows(galWorkItems.AllItems)
where galWorkItems is the gallery of work items.
To summarize,
- Use the following to illustrate zero state when no data exists:
CountRows(DataSource) = 0
- Use the following to illustrate zero state when data exists but isn't displayed possibly because of a search criteria:
CountRows(Gallery.AllItems) = 0
Recent articles
- A-Z: 26 tips! Learn how to improve your Power Apps!
- Add Picture vs Camera Control – Who is the winner?
- Background images for Power Apps screens – the right way!
- Combo box or Dropdown? - Who is the winner?
- Delegation in Power Apps – How to identify and test!
- Edit vs Display – Which is the better form?
- Formulas – How to learn the 170+ Power Apps formulas?
- Galleries vs Data Tables – How to pick between the two in Power Apps?
- Hyperlinks – How to launch web pages & apps in Power Apps!
- Icons – How to increase performance!
- Jump start – How to speed up Power Apps dev with components!
- Keyboard – How to control the keyboard type on mobile
- LastSubmit – How to fetch the last submitted record in Power Apps
- Media controls in Power Apps – How to improve user experience!
- New screens – How to speed up Power Apps dev using templates!
- OnStart – How to optimize app loading experience!
- Phone camera – How to switch cameras on Power Apps mobile!
- Quotes – Should you use single or double in Power Apps?
- Reset – How to reset a Power Apps gallery?
- SaveData – How to persist your Power Apps sessions!
- Tables – How to create tables in Power Apps
- User – How to fetch current user’s details in Power Apps
- Variables – What happens when global & context var have the same name?
- Wrap Count – How to change the layout of Power Apps galleries
- X – Creating X records in a collection using Sequence
- Yes/No – Change data card in Power Apps for better UX!