Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Retrieve – PB Docs 2019 – PowerBuilder Library

Retrieve – PB Docs 2019

Retrieve

PowerScript function

Description

Retrieves data to the DataWindow, DataWindowChild, or DataStore from
the RESTFul Web service according to the key name of the JSON string. If
the data received from the RESTful web service is compressed as gzip, it
will be automatically decompressed. Only gzip compression format is
supported at this moment. The developer can use the SetRequestHeader
function to set the Accept-Encoding header to allow only the gzip
compression format.

Applies to

RestClient object

Syntax

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.

data (optional)

A string or blob data. If this argument is not specified,
the retrieve function sends the request to the server with “GET”
method, otherwise with “POST”.

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.

Usage

The Retrieve function retrieves data only when the JSON key name
matches with the DataWindow column name; if none of the JSON key name
matches with any of the DataWindow column name, then no data will be
inserted into the DataWindow and the function returns error code
-17.

For the Retrieve function, the JSON string returned from the RESTFul
Web service APIs must be an array in the two-level plain JSON format (see
Plain
JSON: two-level structure
in Application Techniques for details); for the RetrieveOne
function, the JSON string returned from the RESTFul Web service APIs can
be an array in the two-level plain JSON format (see Plain JSON:
two-level structure
in Application Techniques for details) or a JSON object.

The Retrieve function is not supported in
DataWindow/DataWindowChild/DataStore with the following presentation
styles: Composite, Crosstab, OLE 2.0, and RichText.

Although the Retrieve function is not supported in the Composite
DataWindow, you can call GetChild function to get the child DataWindow
from the Composite DataWindow, and then call the Retrieve function to
retrieve the data into the child DataWindow.

The Retrieve function is not supported for Report controls,
TableBlob controls, OLE Database Blob controls, and InkPicture controls in
DataWindow objects.

The Retrieve function is not supported for dynamically created or
modified DataWindows.

AutoRetrieve for DropDownDataWindow is unsupported.

The Retrieve function will not pass the retrieval arguments used in
computed fields and DataWindow expressions.

The Retrieve function will not trigger the DataWindow RetrieveRow
event considering the performance impact, although it will trigger the
RetrieveStart and RetrieveEnd events.

Return value

Long.

Returns values as follows. If any argument’s value is null, the
method returns null.

>=0 — Returns the number of rows if it succeeds

-1 — General error

-2 — Invalid URL

-3 — Cannot connect to the Internet

-4 — Timed out

-5 — Get token error

-7 — Failed to automatically decompress the response body

-10 — The token is invalid or has expired

-15 — Unsupported character sets

-16 — The JSON is not a plain JSON with two-level structure

-17 — No data is inserted into the DataWindow because no key in the
JSON matches any column name in it

Example 1

This example retrieves data to a DataWindow:

Example 2

This example retrieves data to a DataStore:

Example 3

This example retrieves data to a DataWindowChild:

Example 4

This example passes the string data using POST method and retrieves
data to a DataWindow.

Example 5

This example passes the blob data using POST method and retrieves
data to a DataWindow.

Example 6

This example passes the string data using POST method and retrieves
data to a DataStore.

Example 7

This example passes the blob data using POST method and retrieves
data to a DataStore.

Example 8

This example passes the string data using POST method and retrieves
data to a DataWindowChild.

Example 9

This example passes the blob data using POST method and retrieves
data to a DataWindowChild.

Example 10

This example gets data from a website with token authentication and
then retrieves data to a DataWindow.

Example 11

This example passes the blob data using POST method and retrieves
the data from the website with token authentication to the
DataWindow.

Example 12

The client sends the server a request which includes the “gzip”
compression method; then the server compresses and returns the data as
requested; and then the client automatically extracts the data.

See also

RetrieveOne


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x