Skip to main content
Version: Next

SAVE VARIABLES

SAVE VARIABLES ( document ; variable {; variable2 ; ... ; variableN} )

ParameterTypeDescription
documentTextDocument in which to save the variables
variableVariableVariables to save

Description

The SAVE VARIABLES command saves one or more variables in the document whose name you pass in document.

The variables do not need to be of the same type, but must be of the String, Text, Real, Integer, Long Integer, Date, Time, Boolean, or Picture type.

If you pass an empty string for document, the standard Save File dialog box appears; the user can then choose the document to create. In this case, the 4D system variable Document is set to the name of the document if one is created.

If the variables are properly saved, the OK variable is set to 1. If not, OK is set to 0.

Note: When you write variables to documents with SAVE VARIABLES, 4D uses an internal data format. You can retrieve the variables only with the LOAD VARIABLES command. Do not use RECEIVE PACKET or RECEIVE VARIABLE to read a document created by SAVE VARIABLES.

WARNING: This command does not support array variables. Use the new BLOB commands instead.

Example

The following example saves three variables to a document named UserPrefs:

 SAVE VARIABLES("User Prefs";vsName;vlCode;vgIconPicture)

System variables and sets

If the variables are saved properly, the OK system variable is set to 1; otherwise it is set to 0.

See also

BLOB TO DOCUMENT
BLOB TO VARIABLE
DOCUMENT TO BLOB
LOAD VARIABLES
System Variables
VARIABLE TO BLOB