Function: Retrieves data for datawindow or datastore. Before using this function, you should have executed settransobject or settrans, and SET transaction objects for the data window. Before executing the function, clear the existing data in the data window, and then retrieve the data in the database to the data window. Therefore, if you want to append the retrieved data to the data window, you need to write a program. 2 is returned in the retrievestart event of the data window object to prevent the existing data in the data window from being cleared.
Function Syntax: Long dwcontrol. Retrieve ({any argument, any argument ...})
Ldwcontrol: data window, datastore, or drop-down sub-data window.
Largument: optional parameter, depending on the definition in the data window object. The number and Data Type of parameters must be consistent with the definitions in the data window object.
Return Value: Number type, indicating the number of rows displayed in the data window after the function is executed. Note that the returned value does not indicate the number of retrieved data rows. There are two points: whether scripts are written in retrievestart and whether filter rules are specified in the data window object definition. If a filter rule is defined in the data window object, data that does not comply with the filter rule is automatically moved to the filter buffer in the data window after the search is completed, the Return Value of the function is the total number of data rows retrieved after deducting the number of data rows moved to the Filter Buffer. Note that only the filter rules defined in the data window object affect the return value of the retrieve function, and the setfilter and filter functions do not.
Code example:
Example 1: The following program displays the prompt information based on the return value of the retrieve function.
Long ll_rows
Dw_main.settransobject (sqlca)
Ll_rows = dw_main.retrieve ()
If ll_rows <1 then MessageBox ("error", "No data is retrieved. ")
Example 2: search with parameters.
The SQL statement of the data window object is as follows:
Select name, EMP. Sal, sales. RGN from employee, sales
Where EMP. SAL>: an_salary and sales. RGN =: as_region
Here, an_salary and as_region are search parameters, which are numeric and numeric respectively. You can use the following syntax to retrieve data:
Dw_1.retrieve (50000, "nw ")