cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
racheljgood119
Level: Powered On

Count the number of items in a sharepoint list

I am making a discipline tracker for a school and I need to count the number of times a student name is entered via the PowerApps form. 

 

Is there a way to count the number of times a student's name is entered and then have it show up in another column in the SharePoint list?

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Count the number of items in a sharepoint list

Hi @racheljgood119,

 

Agree with @Anonymous here.

All the count function under PowerApps is not delegable in PowerApps, so your better choice is to count the collection:

Delegable functions

 

The other question is to have the count data show up in another column, if it is only required to add the count number into the new record, then that is easy to be done, just create a Variable and have its value set to countif() +1.

Updatecontext({CountNum:Countif() + 1})

 

And if you would like to update the count value in all the records with the same name, then it comes to another issue related to delegation.

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Re: Count the number of items in a sharepoint list

You can use a CountIf() for smaller lists. That function will return the number of rows which match a given condition (in your case it will be something like studentName = Author.DisplayName)

 

However, for a large list (in PowerApps this is >500 items) you will need to do something along the lines of the following:

  • Create a new text field which includes a unique identifier for the student (probably email)
  • Copy across their email address into this field (and make sure any new records do so automatically)
  • Do a ClearCollect() and make a new local collection from the sharepoint list, filtering using the students email against the newly created text field.
  • Count the rows on this new local collection.

 

The reason for this is that PowerApps does not support delegation on the Person field on larger lists. If you are to use just a CountIf() and try to filter on the author.displayname field, you will only be accessing the first 500 rows. Any results after will not be retrieved. Quite annoying having to essentially double up on the email but unfortunately it is a limitation we have to deal with at the moment.

Community Support Team
Community Support Team

Re: Count the number of items in a sharepoint list

Hi @racheljgood119,

 

Agree with @Anonymous here.

All the count function under PowerApps is not delegable in PowerApps, so your better choice is to count the collection:

Delegable functions

 

The other question is to have the count data show up in another column, if it is only required to add the count number into the new record, then that is easy to be done, just create a Variable and have its value set to countif() +1.

Updatecontext({CountNum:Countif() + 1})

 

And if you would like to update the count value in all the records with the same name, then it comes to another issue related to delegation.

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (10,163)