websave
Writes a JSON stream from the data in a component to $webinfo("data").
websave{/mod | /one}
Example: websave
Qualifiers
Qualifier | Description |
---|---|
/mod | Includes only modified occurrences in the JSON stream |
/one | Includes only current outer occurrence (with all inner occurrences) in the JSON stream |
Return Values
The output of websave includes
the CRC, ID, and STATUS for every occurrence and is put in the
$webinfo("data")
channel. For more information, see Metadata for Reconnect.
Value | Meaning |
---|---|
<0 | An error occurred. $procerror contains the exact error. |
0 | Success |
>0 | Number of images for which a temporary file could not be created. |
Use
Use in Dynamic and Static Server Page components.
Description
The websave statement creates a JSON stream from the data in a component. The stream is built from the complete hitlist, including occurrences currently marked for deletion. Occurrences and fields are selected from the data set based on switches used by the websave statement.
The entities and fields included in the stream are defined by the component structure, so both database and non-database fields are included in the JSON stream.
You can use the $JSON_INDENT and $JSON_SHOWNAMES assignment settings to make the JSON stream more human-readable for development and debugging purposes.
Triggers Fired by websave
The following triggers are fired by the websave statement and can be used to customize the process of saving a component into an JSON stream:
- trigger preSerialize—fired immediately before an occurrence is saved from a component into a disconnected record set. The occurrence is available and can be examined. For example, an occurrence can be excluded from the save, or the value for a derived field can be calculated.
- trigger postSerialize—fired immediately after an occurrence is saved from a component into a disconnected record set.
Images
When the component contains images from a database, the Uniface Server creates temporary image files in the project directory. If it does not have write privileges for the project directory, this action fails. The page is still presented to the browser, but with image load error icons in the locations of the images.
websave
The following code creates a JSON stream from a component's data structure and writes the result to the message frame.
clear retrieve/e "ORDER.INOUTER" websave putmess $webinfo("data") return
Version |
Change |
---|---|
9.4.01 |
Introduced |