Getting the ‘item count’ of SharePoint lists with more than 2000 items in the Power Apps Canvas app.

Because of the ‘data row limit’ and the ‘delayed loading feature of the gallery’, it was difficult to get the number of SharePoint lists only on the canvas, but an interesting method was introduced as a solution to this problem, so I made a note of it.

スポンサーリンク

What we want to do.

For SPO lists with more than 2000 items, when trying to get the number of items on the canvas side,
only 100 could be taken in the initial view due to the delayed loading function even if AllItemsCount in Gallery is used,
and the CountRows function cannot be used for delegation, Only the data row limit (2000 in the example) could be taken for the number of items.

I could then use Power Automate to get the number of items up to 5000, but I didn’t really like the idea of calling a flow just to get the number of items in the list.

Methods presented in this issue.

This article shows how to solve this problem, and briefly how to ‘move the gallery scrolling from the code’.
Consumer Privacy Act (CCPA) Opt-Out Icon
First, just display the AllItemsCount of the gallery as a label or something,
and put the following expression in the Default property of the gallery.

Last(【GalleryName】.AllItems)

Last(Self.AllItems)  //This formula is also acceptable

The gallery will then move the scroll bar to select the last item, and if you wait a little, the number of all data will be displayed.

However, this construction is not very usable, so it would look better if all the controls in the gallery were deleted,
and the gallery itself was hidden.
* Scrollbars can be moved even if the gallery is hidden.

However, it is difficult to assign this number of cases to variables and so on, as it is not known when ‘all data acquisition will be finished’.
*I think there is a way to wait with a timer or something, but I don’t know how long it would take, so I think it’s iffy.

However, it is often requested to display all the cases at a glance, so this method could be used somewhere else.

Related links

タイトルとURLをコピーしました