Guide to Creating and Utilizing Dataverse Views in Power App Canvas

Guide to Creating and Utilizing Dataverse Views in Power App Canvas

Welcome to our comprehensive guide on Dataverse and its pivotal feature, the Dataverse views. If you’re diving into the world of Power App Canvas, knowing how to effectively create and use Dataverse views will be instrumental in your journey. Dataverse views play an essential role by allowing us to establish queries and filters that can be reused in multiple apps. In this post, we’ll unravel the process to showcase data from Dataverse views in Canvas Apps and the method to reference those views in formulas.

What is a Dataverse View?

Dataverse’s unique feature permits us to set up server-side views. Simply put, a view is a predefined query that Dataverse operates on the server. The brilliance of a view lies in its capability to isolate intricate query expressions, making them reusable for both canvas and model-driven apps. This not only makes multiple canvas apps display data from an identical view but also ensures any update made to a view is replicated across all apps. Thus, eliminating the hassle of altering numerous apps.

Creating a Dataverse View

To initiate a view, navigate to the table designer through the Maker Portal. This is where you get an option to add a fresh view from the view tab. Using the view designer, it becomes easy to lay down filter parameters and decide the output’s sort order.

However, it’s crucial to understand that, unlike SQL Server, Dataverse supports rather basic view definitions. This means you can’t create views that span multiple table levels or merge other tables.

Exhibiting Dataverse View Contents in a Gallery

For those who wish to showcase the Dataverse view’s contents in a gallery from a canvas app, the process is straightforward. Begin by adjusting the gallery control’s Items property to reflect the foundational table. Subsequently, a ‘Views’ option will emerge below the table, enabling the selection from available views. Do remember that this ‘views’ property is exclusive to the gallery control. So, you won’t find this setting when linking a data table or combo box control to a Dataverse table.

Referencing a Dataverse View in Formulas

Accessing Dataverse views in formulas is done using the Filter function. Pass the table title as the primary argument and the view name as the secondary one. For clarity, consider the following example:

Filter(PropertyDocuments,
      'PropertyDocuments (Views)'.'PDF Documents')

This demonstrates setting the Items of a listbox control to present records from a ‘PDF documents’ view rooted in the “PropertyDocuments” table.

For those wanting to append extra criteria to the Filter function, here’s a way to incorporate an added condition. This condition fetches only those records from the view made within the previous 30 days:

Filter(PropertyDocuments,
       'PropertyDocuments (Views)'.'PDF Documents', 
       'Created On' > DateAdd(Now(), -30))

Conclusion

Dataverse offers a seamless experience to query and filter data via views. Today, we delved into the intricacies of creating a view, presenting data from a view in Canvas Apps, and referencing views in formulas. Whether you’re a novice or a seasoned user, understanding these concepts can significantly enhance your Power App Canvas experience.

If you find yourself needing further insights or technical assistance on this topic or others, please contact us. Our dedicated team is here to help, and we’re always eager to assist you in your endeavors.

About The Author