Official Content

Obtains or sets the number of records of a Grid or Freestyle Grid.

Scope

Objects: Web Panel
Generators: .NET, .NET Framework, Java
Controls: Free Style Grid, Grid

Description

The RecordCount property returns the number of records of the Grid that meet the selection conditions. It may return -1 if the program could not determine it (it was not assigned and it could not be calculated automatically).  
 

Value Comment Suggestion
-1 It could not be determined. Typically, the Grid does not have a base table or the loading conditions are evaluated client side. Since the program could not calculate it automatically, you should set its value in the Refresh event.
>= 0 Number of records of the Grid base table  

Runtime/Design time

This property applies only at runtime.

Samples

1) Grid with base table (GridCount could be calculated automatically)

Event Refresh
msg(str(Grid1.RecordCount))
msg(str(grid1.PageCount))
EndEvent

2) Grid is based on SDT (GridCount could be calculated automatically)

Event Refresh
   &Clients = ClientsGet()
   msg(str(grid1.RecordCount))    
   msg(str(grid1.PageCount))
EndEvent
Event Load
    for &Client in &Clients
        &Clientid = &Client.ClientId
        &ClientName = &Client.ClientName
        load
    endfor
EndEvent

3) Grid is loaded from external sources (RecordCount could not be calculated automatically)
This case requires that RecordCount is assigned in the Refresh Event. If not, the Pagecount could not be determined when the Web Panel loads.

Event Refresh
   grid1.Rows = 5
   grid1.RecordCount = 12
   msg(str(grid1.PageCount))
   msg(str(grid1.RecordCount))
Event Load
   for &i = 1 to 12
      &ClientId = GetClientId(&i)
      &ClientName = GetClientName(&i)
      load
   endfor
EndEvent

See Also

PageCount Property
Grid paging on the Web
Paging in apps

Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant