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!