DSC Tech Library
WebAPI Web Access To Telemation
WebAPI - Simple Flow
Upon initialization of the application, the user should call WebApiSetHostName() to establish which server he will be talking to, then WebApiSetDBASE() to indicate which DBASE the server webapid will be using to reference and access provided File Definition names (neither of these calls as yet cause a communication between client/server).
At this point, the users options are to either query file descriptions (WebApiDescribeFields()) or to set up the search criteria (WebApiSetSearch()/WebApiSetSearchOn()). WebApi32, at this revision, permits a simple search consisting of two Boolean requests that may be ANDed or ORed. The syntax is described below in Visual Basic Descriptions and Declarations of WebApi routines, below. At the very least (if one were to wish to return all records from a file, which could challenge local memory), a File Definition name must be provided via one of these two search criteria routines before any data can be retrieved.
If a valid search has been set up, then the programmer may call WebApiReturnRecords() in order to do the actual data retrieval. This routine returns, as a function, the number of records that satisfied the search. As mentioned earlier, these records are stored in local client memory for subsequent iterative retrieval, so some prudence is in order regarding the number of records to return and the number of fields returned for each record. The technique of these routines will probably be expanded – for example, providing a “maximum number of records to return” functionality, etc.
Once a successful record set on a reference number is returned, the user calls WebApiReturnRecord() iteratively, providing a 0-based “which record” argument, allowing one to loop through the record set forwards or backwards, or randomly access them. A uniquely identifying record number (Recno) is returned for each, which may be used by the routines WebApiChangeRecno()/WebApiDeleteRecno() (there are also versions of these routines which will change/delete records based on the 0-based “which record” number as well).
Routines have been provided to flush (clear memory) for reference sets, in case of extended processing. However, reuse of reference sets automatically flushes old data, and exiting the program automatically cleans these up.