In blog, I have explained what Delegation is and how it improves app performance. Blog also covers delegable vs non-delegable data functions and data sources. In this blog we will focus on Image type fields which are also non-delegable, means Image type fields cannot be delegated and use of them will retrieve full dataset on application layer and process them locally.
By default, when CDS data source is mapped to Gallery control with image, images do not load. Reason behind, CDS data source is delegable and would not retrieve non-delegable data (image) by default. To solve this problem and load images, you need to use at least one non-delegable data source or function in Items property of Gallery control. Use of non-delegable type will retrieve all data including images and images will be shown in Gallery.
Let’s see how this works with an example:
- I have a form “Product List” which Gallery control. Gallery control is mapped with CDS data source “Company Products” with layout set as “Image, title, subtitle”. Ideally images should load but as shown below images do not load. Keep an eye on Items property of Gallery.
- Now update Items property of Gallery control to include non-delegable type – Filter function on “_statuscode_label” which is complex type and non-delegable to display only Active products. As soon as you use non-delegable type, blue dot appears as a warning.
Filter(‘Company Products’, _statuscode_label = “Active”)
Note that use of non-delegable types will slow down your app. In this case Collection helps you to store data temporarily which expires when app is closed.