# glostr, glonum, globool, glodate()

### glostr(name)

Retrieves the string value previously stored under the value for the name argument.

### glostr(name, source)

Stores the string value of the source argument under the value for the name argument.

### glonum(name)

Retrieves the number value previously stored under the value for the name argument.

### glonum(name, source)

Stores the number value of the source argument under the value for the name argument.

### globool(name)

Retrieves the boolean value previously stored under the value for the name argument.

### globool(name, source)

Stores the boolean value of the source argument under the value for the name argument.

### glodate(name)

Retrieves the datevalue previously stored under the value for the name argument.

### glodate(name, source)

Stores the date value of the source argument under the value for the name argument.

## Arguments

Argument | Data Type | Description
name | string | name by which a value to be stored or retrieved is referred to
source | see above | Type and value of data to be stored under the name argument

## Returns

The previously stored value for the given name argument

## Description

The glostr(), globool(), glodate() and glonum() functions are used to create variables which are stored to disk, and can then be used in different import sessions. For example, you can record the date of the last import session.

Global variables can be accessed from SQL SELECT statements when defining the data source, which means that it is possible to have incremental updates from a data source. See Using Global Variables in SQL for more information.

It is important to note that global variables will only be saved at the end of the session i.e. after all the records have been read and processed.

### Creating

To create a variable, provide values for both arguments. The first value is the name of the variable and the second is the value to be stored. To update a variable, provide the name of the variable to the first argument and the value to update it with as the second argument.

All variable names have to be string values, and each name has to be different. If you use the same name for different variables, the second will overwrite the first.

Each variable will only hold one value.

Unlimited variables can be created for all variable types.

### Retrieving

To retrieve the value of a variable simply provide the name of the required variable as the value of the first argument. If this variable does not exist an error message will be shown

The types of values (string, number, boolean, date) that can be stored are determined by the specific function used. glostr() holds string values, globool() holds boolean values, glonum() holds number values and glodate() holds date values. This means that the function globool() can only hold boolean objects, such as the value of a function that returns a boolean value: it will NOT accept strings, such as "true" or "false"

## Examples

Assume that these examples are performed in the same order that they are listed

Assume that field1 contains the value "The quick brown fox"

Example | Returns | Description
glostr("test", "test me") | test me | Places the string value "test me" into the variable under the name "test" and returns the value
glostr("test") | test me | returns the previously stored string value for the variable named "test"
glostr("test", "test me again") | test me again | replaces the previously stored string value for "test" with the new string value and returns that value
glonum("testnum", 100) | 100 | Places the number value 100 into the variable under the name "testnum" and returns the value
globool("testbool", contains(#1,"a")) | false | Places the boolean value "false" into the testbool variable and returns that value

## See Also

counter(), recno(), recstr(), recnum(), recbool(), sesstr(), sesnum(), sesbool(), exists(), flushglovar()