datatype(
datatype(
NAME
)

The datatype( function determines what kind of data is in a field or variable: text, number, etc.

Parameters

This function has one parameter:

name – is the name of the field or variable that you want to determine the type of.

Description

The function returns the type of data from this list: Text, Integer, Float, Binary, Date or Choice.

Here’s an example which checks the AreaCode variable. If it is text, it converts it into a number.

    if datatype("AreaCode")="Text"
        AreaCode=val(AreaCode)
    endif

Note: The Choice and Date types can only occur if the datatype( function is used with a field as the parameter. Variables cannot contain data of these types (for a date, the data type is Integer).

Note: Panorama 6 and earlier also used Fixed Point data types. These are no longer used.

Note: Panorama 6 and earlier returned Floating Point instead of Float.

See Also

- binarydatatype( -- returns information about the type of structure data contained in a binary data value, if available (see Binary Data).
- Choices -- fixed list of choices.
- Dates -- working with dates.
- expressiontype( -- determines what kind of data is generated by an expression: text, number, etc.
- Fields -- introduction to database fields.
- info("datatype") -- returns the data type of the current field.
- Numbers -- Working with numeric values in a formula, and converting between numbers and text.

History

Version | Status | Notes
10.0 | Updated | Carried over from Panorama 6.0, but now quoting the field or variable name is optional. Also, the function may now return these values: Text, Integer, Float, Binary, Date or Choice.