[stackoverflow] [progress Openedge Abl] Fastest Way To Get The Total Number Of Records For...

Status
Not open for further replies.
J

Joe Clay

Guest
Because I clearly did something terrible in a past life, I'm currently developing a REST API in OpenEdge (using the new object-oriented WebSpeed handlers), to be consumed by a Kendo grid widget.

One area that I'm really struggling with is implementing paging - the Kendo grid requires the API to provide it with a total number of records in order to determine how many pages there are. The only recommended way I've found of doing it is to do a PRESELECT query and then use NUM-RESULTS, like so:

CREATE QUERY hQuery.
hQuery:SET-BUFFERS(BUFFER sales_order:HANDLE).
hQuery:QUERY-PREPARE("PRESELECT EACH sales_order WHERE co_no = 1").
hQuery:QUERY-OPEN().
oJson:Add("total", hQuery:NUM-RESULTS).


This, predictably, is stupidly slow - the requests to the server went up from 72ms to 800ms per page, making the grid feel very sluggish.

The obvious solutions here are:

  • Cache the number of records: I don't have the authority to make database changes, and it would require updates to a legacy system to keep this in sync, so I feel like this would open a can of worms.
  • Get the number of records asynchronously: If you don't return the total in the original request, the Kendo grid will only let you get it through a synchronous request, which I can't imagine will work wonders for the user experience.

So, my question is, are there faster ways of getting the total number of records for a query?

Continue reading...
 
Status
Not open for further replies.
Top