Variables
Variable Utilities
|
Purpose: |
Assign a value to a variable. |
|
Category: |
Variables |
|
Syntax: |
SetVar "variable" "value" variable The name of a variable. value The value (text, number, etc.) to assign to the variable. To delete an existing variable, leave the value parameter empty. |
|
Example: |
In the example below, the variable [Price] is set to "49.95" and the variable [Name] is set to "Ralph Jones": SetVar "[Price]" "49.95" You may also use SetVar to modify or combine existing variables. For example: SetVar "[FullName]" "[LastName], [FirstName] [MiddleName]" Normally, if value contains a valid mathematical formula, VisualNEO Win will compute the formula and store the results in the variable. If for some reason, you want the variable to contain the actual formula instead of formula's computed result, insert an exclamation point “!” at the beginning of value. For example, the following statement: SetVar "[Test]" "1+1" will set the variable [Test] to "2". This is because VisualNEO Win knows that "1+1" is a mathematical equation and adds the two numbers together. By adding an exclamation point you can instruct VisualNEO Win to ignore the formula. For example: SetVar "[Text]" "!1+1" will set the variable [Test] to "1+1". (Note: The exclamation point is removed by VisualNEO Win.) You can use this technique in any VisualNEO Win Action where numeric parameters are allowed. |
|
Purpose: |
Define a typed variable. |
||||||||||||||||||||||||||||||||
|
Category: |
Variables |
||||||||||||||||||||||||||||||||
|
Syntax: |
DefineVar "variable" "type" "format" "scope" "value" variable The name of the variable to be defined. type One of the following:
format For decimals this parameter is the number of decimal places. For dates, format is composed from the items below separated by the “/” character:
For example, entering “d/m/yyy” will result in a date formatted as Day/Month/Year or “3/15/2007” The format parameter is ignored for all other variable types. scope One of the following:
value (optional) An initial value to assign to the variable. Must be compatible with the selected type. |
||||||||||||||||||||||||||||||||
|
Example: |
Example: DefineVar "[Birthdate]" "Date" "m/d/yyyy" "Global" "1/1/1980" In order to delete a variable created with DefineVar, you must first re-declare the variable as “Undefined”, then clear it with SetVar. For example: DefineVar "[Birthdate]" "Undefined" "" "Global" "" |
|
Purpose: |
Save the contents of all existing variables to a file. Use this Action to save a publication’s entire complement of variables at once. Since variables reside in memory and are cleared when a publication closes, you can use SaveVariables and LoadVariables to remember publication settings between sessions. |
|
Category: |
Variables |
|
Syntax: |
SaveVariables "file name" file name The name of the file to store the variable data. |
|
Example: |
SaveVariables "mypub.var" |
|
Purpose: |
Load variables from a file previously created with SaveVariables. Use this Action to load an entire group of variables at once. Since variables reside in memory and are cleared when a publication closes, you can use SaveVariables and LoadVariables to remember variables between sessions. |
|
Category: |
Variables |
|
Syntax: |
LoadVariables "file name" file name The name of an external file containing the variables to be loaded. |
|
Example: |
LoadVariables "[PubDir]MyPub.var" |
|
Purpose: |
Clear variables from memory. |
|
Category: |
Variables |
|
Syntax: |
ClearVariables "variable list" variable list A list of a list of variables to be cleared. Separate multiple variables with comma or pipe “|” characters. Leave this parameter blank to clear all variables. |
|
Example: |
The following example will clear all variables in the publication: ClearVariables "" The following example will clear only those variables listed: ClearVariables "[FirstName],[LastName],[Street],[City],[State],[Zip]" |
|
Purpose: |
Delete an array of variables. |
|
Category: |
Variables |
|
Syntax: |
DeleteArray "array name" "array size" array name The name of the array variable to delete. array size The number of elements to delete or “All” to delete the entire array. |
|
Example: |
DeleteArray "Clients" "All" |
|
Purpose: |
Count the number of items in a variable array. Returns the array’s upper and lower bounds plus total number of items in array. |
|
Category: |
Variables |
|
Syntax: |
GetArrayInfo "array name" "min var" "max var" "size var" array name The name of the array variable to examine. min var The variable to store the index of the lowest element in the array. max var The variable to store the index of the highest element in the array. size var The variable to store the total number of elements in the array. |
|
Example: |
GetArrayInfo "[Names]" "[Low]" "[High]" "[Size]" |