I am working on an app that uses entities for displaying and editing data in a gallery. It uses large amounts of data (100+) and upon scrolling through the data there is usually a delay before next data shows - about 2-3 seconds. Is it possible for data to show instantly when scrolling up and down?
I am working with Dynamics 365 entities.
This is the "Items" expression I have for my gallery:
Filter(SortByColumns(Search(D365EntityDataSource, BCA_SearchInput.Text, "BatchId"), "BatchId", If(SortDescending, Ascending, Descending)), selectedItemNum in itemId)
Is there a way to optimize this?
Would be very helpful to have someone's input on this. Thanks.
A couple of questions:
1. Are you using a regular gallery or a flexible gallery control? Note that a regular gallery has a much better performance and if all your gallery cells should roughly have the same size, consider using it.
2. Are you experiencing the delay on a mobile device? If so then is the performance good in a web browser?
3. Are you experiencing the delay on any scrolling (page 2 -> 3 for example) or in certain places? The reason for this question is that the gallery loads data in larger chunks so it would be god to know if the scrolling is affecting by the loading of next chunk of data.
Hey @dinusc and thanks for looking into this.
1. Unfortunately I am not sure which, sorry - I assume that regular gallery. Feel free to have a look at a screenshot at the bottom of my post. I've made a custom layout.
2. I am experiencing delay both on web browser and also on the mobile device. No difference in performance.
3. I have 2 other screens that have galleries with similar layouts and they are also taking some seconds before loading chunks of data upon scrolling. I'm wondering why is it taking a while to load chunks of data - as if it's grabbing it from entity with each scroll, instead of storing all the data in cache and taking it from there smoothly.
Below in the spoiler is a screenshot of my gallery and how it looks. I've blurred out the data itself - but I'm sure you get the idea. The reason for me using exactly gallery in this case is possibility of editing rows on the same screen whilst applying changes to all of them back to entities. Not possible with table control unfortunately.
Thank you for all the details.
Normally the items should be pre-loaded and cached locally as you mentioned.
I will try to reproduce the issue by creating a test app with similar layout.
If you do not anticipate having more than 2000 items in your data source, you can create a collection when the screen becomes visible and use that as the data source for your gallery. ie. Collect(ds, D365EntityDataSource). Your Items property would be Filter(SortByColumns(Search(DS, BCA_SearchInput.Text, "BatchId"), "BatchId", If(SortDescending, Ascending, Descending)), selectedItemNum in itemId). The data in the TextInput and Dropdown controls. would still be patched to "D365EntityDataSource". This should speed up the scrolling considerably.
@Drrickryp, Normally pre-collecting items should not affect the gallery scrolling as the Gallery control is supposed to cache the batch items locally. The only difference it can make is to avoid delays when preloading the next chunk (batch). This comes with a signifficant disadvantage though. Preloading all the items in memory may be a problem for mobile devices. This is the main reason why the gallery never loads all the items at once.
@Maximilian, I've tried reproducing the issue that you see with no luck. Can you confirm that all the child items in the gallery are bound via "ThisItem"? Also do you have any extra formulas for altering child control states (size, position visibility or else)?
In my test, I have a gallery with 2 labels, 1 textinput and one combobox control bound to a test list. All the child controls are bound via gallery's "ThisItem". The scroll seems to be running smoothly. I would appreciate your help in reproducing the problem.
@Drrickrypthanks for the suggestion, however there may be cases that there would be more data than you've said. Sounds like it would place a lot of pressure on the device memory.
@dinuscthey are bound via "ThisItem", yes. I do have custom sizing and position for X, Y and Width. Not all controls in the gallery are equal when it comes to position and size. Could that be the issue? I will give it a shot making them the same, but I doubt that could be the problem.
This is not a huge problem, but getting it to work smoothly would certainly make me learn something new and see it working as intended. Honestly, at this point it seems that it is the connection between the entities machine and PowerApps cloud - it also takes a bit of time to load data in general when opening screens.
Thank you for your time guys.
Normally, the initial data loading (as you mentioned) and loading next chunks may be affected by network delays. Scrolling within a single chunk of data however (within 100 or so items) should only be affected by the srcipt processing time that should be insignifficant for regular galleries. Flexible height gallery has a much more complex logic and therefore may exhibit such behavior. The easiest way to identify the flexible height gallery is by missing WrapCount property in advanced properties panel. Only regular galleries have that property.
Check it out!
Check it out!
Fill out a quick form to claim your user group badge now!
Find out where you can attend!
Features releasing from October 2019 through March 2020
The largest Power BI, Power Platform, and Data conference in New Zealand