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

Count Rows Delegation Warning

I am using the CountRows and getting Delegation Warning. Any suggestions how to get around the Delegation Warning? Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
Eloy
Level: Powered On

Re: Count Rows Delegation Warning

No need to use CountRows any more, and also your view is incorrect

do these steps instead:

1) Create the correct view

create view vwTotalTickets as 
Select Count(ticket_num) as totalTickets from wynne_tickets

2) Go to your PowerApp and create a new Datasource by going to  View -> DataSources -> Add Datasource  -> Select your SQL Database and then Select your View.

 

3) In your Ticket screen, change the default property for the All Tickets label to the following:

Text(First('[dbo].[vwTotalTickets]'.totalTickets).totalTickets)

This should take care of the problem.

5 REPLIES 5
Community Support Team
Community Support Team

Re: Count Rows Delegation Warning

Hi @thunter ,

 

It is true that CountRows() doesn't support delegation. See in documentation:

Counting functions such as CountRowsCountA, and Count can't be delegated.

Delegation Info

 

It will still return you the number of rows but it will not return more than 500. You can change the number from 500 to 2000. 

 

I would suggest that you could use CountRows() directly on the gallery or collection.

 

Examples:

CountRows(Gallery.AllItems)

OR

CountRows(MyCollection)

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Eloy
Level: Powered On

Re: Count Rows Delegation Warning

The way I get around that is by creating a SQL View that gives you the count of all the rows in a table. Then all you have to do is to call the view and you will always get correct count of records.

 

Create View As TotalTickets

Select Count(tickteId) as totaltickets from tabletickets

 

Hope this helps!!

thunter
Level 8

Re: Count Rows Delegation Warning

@Eloy  @v-monli-msft 

So I created a View in SQL:

 

But I still get the Delegation Warning

Eloy
Level: Powered On

Re: Count Rows Delegation Warning

No need to use CountRows any more, and also your view is incorrect

do these steps instead:

1) Create the correct view

create view vwTotalTickets as 
Select Count(ticket_num) as totalTickets from wynne_tickets

2) Go to your PowerApp and create a new Datasource by going to  View -> DataSources -> Add Datasource  -> Select your SQL Database and then Select your View.

 

3) In your Ticket screen, change the default property for the All Tickets label to the following:

Text(First('[dbo].[vwTotalTickets]'.totalTickets).totalTickets)

This should take care of the problem.

thunter
Level 8

Re: Count Rows Delegation Warning

Thanks @Eloy that worked!