ChangeDataType (FPScript)

21.09.2021

Converts the data type of a data set.

Syntax

ChangeDataType(DataSet, DataType)

 

The syntax of the ChangeDataType function consists of the following parts:

Part

Description

DataSet

The data set whose data type is to be converted.

All data structures are allowed. All data types are permitted.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

DataType

Specifies the target data type for the conversion.

The argument DataType can have the following values:

Constant

Meaning

TYPE_BOOLEAN

Data type code for a Boolean value.

TYPE_INTEGER16

Data type code for a 16-bit integer.

TYPE_INTEGER32

Data type code for a 32-bit integer.

TYPE_INTEGER64

Data type code for a 64-bit integer.

TYPE_FLOATINGPOINT32

Data type code for a 32-bit floating point value.

TYPE_FLOATINGPOINT64

Data type code for a 64-bit floating point value.

TYPE_COMPLEXINTEGER16

Data type code for a complex 16-bit integer.

TYPE_COMPLEXINTEGER32

Data type code for a complex 32-bit integer.

TYPE_COMPLEXINTEGER64

Data type code for a complex 64-bit integer.

TYPE_COMPLEXFLOATINGPOINT32

Data type code for a complex 32-bit floating point value.

TYPE_COMPLEXFLOATINGPOINT64

Data type code for a complex 64-bit floating point value.

TYPE_STRING

Data type code for a string.

TYPE_CALENDARTIME

Data type code for calendar time.

TYPE_TIMESPAN

Data type code for time span.

Remarks

If DataSet is a data series or a data matrix, then the type conversion takes place on a per-element basis and the result is once again a data series or data matrix. If a signal, a signal series or a space curve is converted, only the Y component is considered. The result then contains the unchanged X component and possibly the Z component of DataSet.

The Boolean value TRUE results in the Value 1 and FALSE results in the value 0. You can apply the operator to all real and complex data types as well as calendar times, time spans and strings. The absolute value is formed when converting complex data types into real data types. When converting strings, the country-specific decimal character specified in Windows settings is used. The Empty type results in 0.

Available in

FlexPro View, Basic, Professional, Developer Suite

Examples

ChangeDataType(1.7, TYPE_INTEGER64)

Results in 1L. The value is rounded down during conversion.

ChangeDataType(2 Pi, TYPE_INTEGER32)

Results in 6. The value is transformed to the unit "1" before conversion.

ChangeDataType((2, 2), TYPE_FLOATINGPOINT64)

Results in 2.82842712474619. The result is the root of eight. This is the absolute value of the complex number.

ChangeDataType(3, TYPE_BOOLEAN)

Results in TRUE. All values except zero result in TRUE.

See Also

DataType Function

Data Types

Boolean Operator

Integer16 Operator

Integer32 Operator

Integer64 Operator

FloatingPoint32 Operator

FloatingPoint64 Operator

ComplexInteger16 Operator

ComplexInteger32 Operator

ComplexFloatingPoint32 Operator

ComplexFloatingPoint64 Operator

String Operator

CalendarTime Operator

TimeSpan Operator

Share article or send as email:

You might be interested in these articles