ChangeDataType (FPScript)
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:
|
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
ComplexFloatingPoint32 Operator