PilotScript Property Type Functions

The following property type functions are available for PilotScript components.

Property Type Function Name/Prototype Description Example

Boolean

Boolean Boolean(Property var)
Returns the property value converted into a boolean True/False.
P := 'true';

B := boolean(P);

The property B contains a boolean value of True (which is different from containing the string value "true" as P does). This is a convenience function; you can obtain the same result by assigning the property and then using ChangePropertyType to convert it.

ChangePropertyType

None ChangePropertyType(Property prop, String typename)

Changes the data format in which a property value is stored. The typename argument is the textual name of a supported data type.

Legal types are (in the shortened format type described in GetPropertyType as format code "2"):

  • BitFingerprint
  • BitFingerprintArray
  • Bitset
  • BitsetArray
  • Boolean
  • BooleanArray
  • Byte
  • ByteArray
  • DateTime
  • Double
  • DoubleArray
  • DoubleFingerprint
  • Integer
  • IntegerArray
  • IntegerFingerprint
  • Missing
  • NDimensionalArray
  • NDimensionalaValueArray
  • Null
  • NullArray
  • String
  • StringArray
  • StringFingerprint
  • ValueArray

"LongFingerprint" is accepted as a synonym of "IntegerFingerprint" for backwards compatibility.

While this list uses format code "2", any of the formats returned by GetPropertyType are legal. (Note that some type changes are not permitted, and cause errors when attempted. For example, changing the text string "tree" to a long integer does not make sense.)

Resize(a, 3);

a[1] := 1;

a[2] := 2; 

a[3] := 3; 

ChangePropertyType(a, 'IntegerFingerprint');

This creates an array of three integers, and declares its type to be an integer fingerprint.

Double

Number Double(Property var)
Returns the property value coerced into a floating-point number.
P := '123.4';

F := double(P);

The property F contains the floating-point value 123.4 (which is different from containing the string value "123.4" as P does). This is a convenience function; you can obtain the same result by assigning the property and then using ChangePropertyType to convert it. Use this function to ensure that a property is the appropriate type before conducting a mathematical operation.

GetPropertyType

String GetPropertyType(Property prop[, Number formatCode=0])
Returns the data type of the specified property as a text string. This type is the underlying format in which the property is stored. By default, format code of "0" returns strings that contains a mixture of pre-4.0 types and the newer, longer, "SciTegic.value.XXXValue" types. A format code of "1" returns only the longer format. A format code of "2" returns only the short "XXX" form of the type.
P := Integer(6);

T0 := GetPropertyType(P);

T1 := GetPropertyType(P, 1);

T2 := GetPropertyType(P, 2);

The properties T0,T1,T2 contain the strings "Long", "SciTegic.value.IntegerValue", and "Integer", respectively.

P := 6.8;

typeofP := GetPropertyType(P, True);

The property typeofP contains the string "SciTegic.value.DoubleValue".

Integer

Integer Integer(Property var)
Returns the property value coerced into an integer value.
P := '123';

I := integer(P);

Property I contains integer value 123 (different from containing the string value "123" like P). This is a convenience function. To obtain the same result, assign the property and using ChangePropertyType to convert it. Use this function to ensure that a property is appropriate before conducting a mathematical operation.

IsDate

Boolean IsDate(String var)
Returns True if var is or can be converted into a date or date time value.
a1 := '12/4 12:05 PM arf'; 
a2 := '12/3'; 
a3 := '12/4 12:05 PM'; 
a4 := '13-Mar-05'; 
a5 := DateTimeCurrent(); 

b1 := IsDate(a1); 
b2 := IsDate(a2); 
b3 := IsDate(a3); 
b4 := IsDate(a4); 
b5 := IsDate(a5);

If executed, the values for b1 - b5 are "false", "true", "true", "true", "true".

IsInteger

Boolean IsInteger(String var)
Returns True if var is or can be converted without loss into an integer value.
a1 := 'arf';

a2 := '111';

a3 := '111.111';

a4 := integer(111);

a5 := 111.111;


b1 := IsInteger(a1);

b2 := IsInteger(a2);

b3 := IsInteger(a3);

b4 := IsInteger(a4);

b5 := IsInteger(a5);

If executed, the values for b1 - b5 are "false", "true", "false", "true", "false".

IsNull

Boolean IsNull(String var)

Returns "True" if var is a null value (Scitegic.Value.NullValue) or null array value (Scitegic.Value.NullArrayValue).

var is defined and returns false for a single null value (Scitegic.Value.NullValue), so confirm whether var is a null value by calling IsNull.

a1 := 5; 
b1 := isNull(a1); 
ChangePropertyType(a1, 'Null'); 
b2 := isNull(a1); 

b3 := a1 is defined; 

ArrayResize(a4, 0); 

b4 := isNull(a4); 

b5 := a4 is defined; 
b6 := isNull(aundef);

If executed, the values for b1 – b6 are "false", "true", "false", "true", "true", "false".

IsNumber

Boolean IsNumber(String var)
Returns True if var is or can be converted into a floating-point value.
a1 := 'arf';

a2 := '111';

a3 := '111.111';

a4 := integer(111);

a5 := 111.111;



b1 := IsNumber(a1);

b2 := IsNumber(a2);

b3 := IsNumber(a3);

b4 := IsNumber(a4);

b5 := IsNumber(a5);

If executed, the values for b1 - b5 are "false", "true", "true", "true", "true".

String

String String(property var)
Returns the property value converted into a string.
P := 123.4;

S := string(P);

The property S contains the string "123.4" (which is different from containing the number 123.4 as P does). This is a convenience function; you can obtain the same result by assigning the property and then using ChangePropertyType to convert it.