Description
Retrieves data for one DataWindow, DataWindowChild, or DataStore using the .NET DataStore Web API.
Applies to
Syntax
objectname.RetrieveWithModel (dwControl, urlName {, tokenrequest} {, param1, param2, param3…})
Argument |
Description |
---|---|
objectname |
A reference to the RestClient object. |
dwControl |
The name of the DataWindow control, DataStore, or child DataWindow. |
urlName |
A string whose value is the URL of the .NET DataStore Web API. |
tokenrequest |
(Optional) A reference to the TokenRequest object for supporting OAuth 2.0. If this parameter is used, the token settings in the SetOAuthToken and SetJWTToken functions will be ignored. |
param |
(Optional) One or more values that you want to use as retrieval arguments in the SQL SELECT statement defined in dwcontrol. (it can be an array) |
Usage
When using RetrieveWithModel to retrieve data to a DataWindow, the DataWindowChild of the DataWindow will be synced with the retrieved data (same behavior as with PowerServer).
Return value
Long.
Returns the number of rows if it succeeds and a negative value if an error occurs. If any argument's value is null, the method returns null.
Example
The following code example shows retrieving data for dw_emp using a .NET DataStore Web API:
long ll_return RestClient lnv_RestClient lnv_RestClient = Create RestClient // Retrieve data via .NET DataStore Service ll_return = lnv_RestClient.RetrieveWithModel(dw_emp, "http://localhost:5099/RetrieveWithModel", 102) // Check the return value if ll_return >= 0 then MessageBox("Success", "Rows = " + String(ll_return)) else MessageBox("Error", "Failed to retrieve data.") end if
See also