letservervariable
VARIABLE
=
VALUE
The letservervariable statement creates a server variable and assigns a value to it.
Parameters
This statement has two parameters:
variable – is the name of the variable that you want to create.
value – calculates the value that will be placed into the variable.
Description
This statement works just like an assignment, but the destination of the assignment is a server variable (associated with the current database, which must be a shared database). Instead of being stored on the local computer, server variables are stored on the server, where they can be accessed by any computer that has access to the server.
For example, this statement creates a server variable named pageCount and assigns the value 23 to it.
letservervariable pageCount=23
The value can be any data type, for example text like this:
letservervariable userName="Bob"
Later, the server variable can be accessed by using the servervariable( function, for example:
servervariable("userName") ☞ Bob
Note: This statement is based on the assignservervariable statement, but letservervariable uses an equal sign between the variable name and the value, instead of a comma. The assignservervariable statement also lets you optionally specify an alternate database, and optionally allows the variable name to be calculated with a formula.
IMPORTANT: If you want to modify a shared value by incrementing, decrementing or appending to it, use the adjustservervariable statement or the adjustservervariable( function instead of the letservervariable statement. These operations are designed to correctly modify a shared value in a multi-user environment, so that the correct value is generated even if two or more users on different computers modify the value at the same time.
See Also
- assign -- assigns a value to a field or variable.
- assignfield -- performs an assignment, much like an equals sign or the assign statement. However, the *assignfield* statement only performs the assignment to a database field, not to any variable.
- assignfieldwithsideeffects -- performs an assignment, much like an equals sign or the assign statement. However, the *assignfieldwithsideeffects* statement only performs the assignment to a database field, not to any variable. After performing the assignment, it will run any side effects associated with the field, including formulas and code associated with the field.
- assignfileglobal -- performs an assignment, much like an equals sign or the assign statement. However, the *assignfileglobal* statement only performs the assignment to a fileglobal variable.
- assignglobal -- performs an assignment, much like an equals sign or the assign statement. However, the *assignglobal* statement only performs the assignment to a global variable.
- assignlocal -- performs an assignment, much like an equals sign or the assign statement. However, the *assignlocal* statement only performs the assignment to a local variable.
- assignwindowglobal -- performs an assignment, much like an equals sign or the assign statement. However, the *assignwindowglobal* statement only performs the assignment to a windowglobal variable.
- define -- performs an assignment, much like an equals sign or the assign statement. However, the *define* statement only performs the assignment if the variable is currently undefined. If the variable already has a value, the *define* statement leaves it alone. The *define* statement is especially useful for initializing permanent variables.
- let -- creates a local variable and assigns a value to it.
- letfileglobal -- creates a fileglobal variable and assigns a value to it.
- letglobal -- creates a global variable and assigns a value to it.
- letpermanent -- creates a permanent variable and assigns a value to it.
- letwindowglobal -- creates a windowglobal variable and assigns a value to it.
- server --
- set -- performs an assignment, much like an equals sign or the assign statement. However, the destination of the assignment can be calculated on the fly.
- setfield -- performs an assignment, much like an equals sign or the assign statement. However, the destination field of the assignment can be calculated on the fly.
- setglobal -- sets a value into a global variable. The name of the global variable is calculated on the fly.
- setlocal -- sets a value into a local variable. The name of the local variable is calculated on the fly.
- setlocalsfromdictionary -- converts a dictionary into a collection of local variables. The names and values of the local variables will be derived from the dictionary contents.
History
10.2 | New | New in this version. |