web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Count Rows in a ShareP...
Power Apps
Unanswered

Count Rows in a SharePoint List In Real Time, Prior to SubmitForm and limit new rows at a specific number

(0) ShareShare
ReportReport
Posted on by 17

I have a use case for a PowerApp that needs to only allow the first X number of users to submit data using a SubmitForm.

 

I currently have it kind of working, but I know there are delegation issues so I'm trying to find a better way to do it.

 

I have a Text Label (Label9) that is doing CountRows(SharePointList) as the Text field.

I am then using a variable to read that text label to see if the number is less than the total number of allowed responses:

OnVisible of the default screen:

Set(varaddtocart, false);
If(Value(Label9.Text)<4,Set(varaddtocart,true),Set(varaddtocart,false));  (NOTE: The CountRows() function doesn't seem to work while in the OnVisible screen, which is why I am loading it to a Text Label)

 

I then have the DisplayMode set to disabled for the submit button using that variable.

If(varaddtocart,DisplayMode.Edit,DisplayMode.Disabled)

 

All of the above technically works, but I receive a delegation error on CountRows() and it doesn't seem to work if you have multiple opening the app at the same time (we ended up with more than the allowed number of items, because people had the app open prior to the variable going past its limit). 

 

I am looking for a better way to look at SharePoint List, determine the total number of rows, and not allow any new rows to be added after a certain number of rows of my choosing. 

 

Any help would be appreciated!

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    Hi @nixnac85 ,

    You have not solved the Delegation issue with the Label, just masked it, however if the list numbers are small, you can do this to hide the warning, but with less code/controls.

    With(
     {wList: SPListName},
     If(
     CountRows(wList) < 4,
     DisplayMode.Edit,
     DisplayMode.Disabled
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

     

  • nixnac85 Profile Picture
    17 on at

    Thank you, I might add that!  I am more looking for an alternative that will solve the delegation issue.  I'm struggling to find a way to read the number of rows besides using the CountRows function.

  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    @nixnac85 ,

    There is no solution to that - CountRows() is the only way and it is not Delegable. You could however try something in Power Automate.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard