Try OpenEdge Now
skip to main content
Web Services
Creating OpenEdge REST Web Services : Data Object Services : Coding Business Entities to implement Data Objects : Updates to allow access by Kendo UI DataSources and Rollbase external objects : Adding the Count operation method
Adding the Count operation method
The Count operation method you must add in order for server paging to return the total number of records in the server result set must have the following ABL method signature:
Specifies a name for the method. You annotate the method in Developer Studio for OpenEdge to identify the method with this name as the Count operation so the Kendo UI DataSource in the client app knows how to call its count function as part of invoking the Read operation with paging.
Specifies a string containing the same JSON Filter Pattern value that is passed to the Read operation method.
Specifies an integer that you assign the total number of records in the server result set identified by filter.
You must then ensure that the @progress.service.resourceMapping annotation for the Count operation method includes an operation attribute setting to specify the Count operation and a URI attribute setting to specify the filter input parameter for this method as a URL query parameter (similar to the URI annotation for the Read operation), as follows:
Where countFnName is the name of your ABL Count operation method. As noted previously, you can use the Define Service Interface wizard in Developer Studio for OpenEdge to specify the required annotations for your Count operation method as part of the Invoke Annotations tab options. Note also that you can annotate only one method as a Count operation method in a given Business Entity. The following sample Business Entity (see Sample Read operation updated to handle JFP input and server paging) shows an example of both a Count operation method and its required annotations.
The Kendo UI DataSource calls this Count operation method on the JSDO whenever it calls the JSDO fill( ) method to return a page of data from the server. This method is called by the DataSource only when it has server paging enabled. If you need to, you can also separately call this method on the JSDO like any Invoke operation method, but this usage plays no part in fulfilling DataSource paging requirements. For more information, see the sections on using the JSDO dialect of the Kendo UI DataSource in the Progress Data Objects Guide and Reference: