cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MattyH
Level 8

Displaying total number of items in Dynamics365 data source.

I am looking for a formula that will enable me to show my users the total number of animals we have resident in our locations.

I currently have a gallery where all animals can be located, via various search parameters, including name and ID number, but would also like to show a fixed label which will give the user an immediate figure of how many animals we currently have in total.

CountRows does not work, as is limited to the current gallery size, which, I am led to believe is 100 without refreshing the gallery, and we have several thousand animals at any given time.

Can anyone provide a solution or workaround?

Thanks in advance

MattyH

5 REPLIES 5
Community Support Team
Community Support Team

Re: Displaying total number of items in Dynamics365 data source.

HI @MattyH ,

Could you please share a bit more about your scenario?

Do you want to calculate the total number of animals in your D365 Entity or in your Gallery?

 

If you want to calculate the total number of animals in your D365 Entity, please take a try with the following workaround:

Set the Text property of the Label to following:

CountRows('YourD365Entity')

If you want to calculate the total number of animals in your Gallery at any given time, I think the Timer control could achieve your needs.

Add Timer control within your app, set the Duration property to following:

1000

Set the Repeat property and AutoStart property to following:

true

 Set the OnTimerEnd property to following:

Refresh('YourD365Entity')   /* <-- Refresh your gallery or data source in time */

Set the Visible property to following:

false

 

Set the Text property of the Label to following:

CountRows(Gallery1.AllItems)

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
MattyH
Level 8

Re: Displaying total number of items in Dynamics365 data source.

@v-xida-msft 

Thanks for your response. I have tried both solutions you have suggested.

The first option brings up a Delegation warning. and the count is stuck at 500, the second solution with the timer refreshes the gallery perfectly well, but the count remains stuck at 100. We are looking at over 4000 animals which would fit the required criteria.

 

We currently have more than 6000 animals on our records, 4000 of which are classed as resident, and they are spread over various locations, and it is those resident animals that I want to show the total of. 

 

It seems to work fine when I break it down to an individual count for each location. Might that be the way forward, to sum the seperate locations, rather than try to sum all of the animals in one go?

Community Support Team
Community Support Team

Re: Displaying total number of items in Dynamics365 data source.

Hi @MattyH ,

I agree with your thought almost. Actually, the CountRows() function is a Non-delegable function, it could not be delegated within your Dynamcis 365 Entity.

In other words, in default, the CountRows() function could only process 500 records at most. You could consider change the Non-delegable queries limit to 2000 (maximum value).

Please check the following article for more details:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/delegation-overview

 

As an alternative solution, you could consider calculate the value for each location firstly, and then sum the separated locations.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
MattyH
Level 8

Re: Displaying total number of items in Dynamics365 data source.

@v-xida-msft 

Thanks again for your reply.

As I suspected, then, the only way to do this with the number of animals we have, is to sum the populations in the separate locations.

Can you suggest the best way to go about this?

We have 287 separate locations to sum.

 

Thanks.

MattyH
Level 8

Re: Displaying total number of items in Dynamics365 data source.

I have tried adding a Data Table, showing two columns, the location, and the current occupancy of the location, then tried to sum the Current Occupancy, but it gave the errors attached.

Helpful resources

Announcements
thirdimage

Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors
Users online (6,581)