Variable Types (Datatypes)

Description:
Autoweb can use Variables to store information. Variables are nothing more than memory locations where you can store data (like the memory key on your calculator). While basic calculators can only store one number, AutoWeb can store an unlimited quantity of several types of information. In order to keep track of the different memory locations you create, names are given to the locations. You can then use the name of the variable to reference the saved information.

AutoWeb Variable Types:

Integer

All whole numbers, positive, zero, and negative. Ranging from –32768 to +32767. Mathematical operations can be performed on Integers. Use Integers for counters, pointers, row numbers, etc. The default value for an Integer is 0.

Decimal

Signed decimal numbers with up to 18 digits. You can place the decimal point anywhere within the 18 digits—for example: 123.456, 0.000000000000000001 or 12345678901234.5678. AutoWeb does not support Decimals with a fixed number of decimal places. Mathematical operations can be performed on Decimals. Use Decimals for monetary amounts, totals, etc. The default value for a Decimal is 0.

String

Any set of characters up to a length of 2,147,483,647, Mathematical operations cannot be used on Strings even if there are only number characters in the string. There are many function available for manipulating strings. Use Strings for Names, Addresses, Text, etc. The default value for a String is '' (an empty string).

Boolean

A variable that can store only one of two values, TRUE or FALSE. Use Booleans to remember if a particular condition has occurred. The default value for a Boolean is FALSE.

Usage:
Before using a variable in a script to store information, you must name the variable and tell AutoWeb what kind of variable it is. This is called 'Declaring a Variable'. The format for 'Declaring a Variable' is: <Variable Type> <Variable Name>. Usually it is a good idea to declare all the script's variables at the beginning of the script. Use meaningful names and follow a naming convention to help remind you of the type and purpose of each variable. See the following examples for the naming conventions used in this User's Guide.

Integer Example:
Declare three integers, assign two of them values and add the two values together into the third integer. The naming convention for integers is an 'int' prefix.

// Declare Integers
integer intValue1
integer intValue2
integer intSum

// Assign Values
intValue1 = 5
intValue2 = 7

// Add the two values together – intSum will be 12
intSum = intValue1 + intValue2

Decimal Example:
Declare three decimal variables, assign two of them values and add the two values together into the third decimal. The naming convention for decimals is a 'dec' prefix.

// Declare Decimals
decimal decValue1
decimal decValue2
decimal decSum

// Assign Values
decValue1 = 5.5
decValue2 = 7.25

// Add the two values together – decSum will be 12.75
decSum = decValue1 + decValue2

String Example:
Declare three string variables, assign two of them values and concatenate the two values together into the third string. The naming convention for strings is a 'str' prefix. Notice that the plus sign (+) here works differently than for number Variable Types. String values must be between either single or double quotes.

// Declare Strings
string strValue1
string strValue2
string strConcat

// Assign Values
strValue1 = '1234'
strValue2 = ' Main Street'

// Concatenate the two values together – strConcat will be '1234 Main Street'
strConcat = strValue1 + strValue2

Boolean Example:
Declare a boolean variable and two string variables, assign a value to the boolean variable. Based on the value, get a Password or a User ID. The IF statement is documented in the 'Controlling Script Execution' section of this manual. The naming convention for booleans is a 'bool' prefix. Do not use quotes around boolean values.

// Declare Variables
boolean boolPassword
string strPassword
string strUserID

// Assign Value
boolPassword = TRUE

// Get either the UserID or Password based on the boolean value
If boolPassword
 strPassword = InputBox('Enter Data', 'Please enter Password', 'Passowrd:', 'OK')
Else
 strUserID = InputBox('Enter Data', 'Please enter User ID', 'User ID:', 'OK')
EndIf

Hosted by www.Geocities.ws

1