%Type
This special method returns a string describing the type of a field:
-
"array"
-
"boolean"
-
"null"
-
"number"
-
"object"
-
"string"
-
"undefined"
All special method names and keywords are case-insensitive.
Syntax
object->%Type(Field, "field")
Syntax elements
objectAn expression that evaluates to an internal object.
fieldA field name in object. Note that it must be quoted.
Applicability
Internal objects only.
Example
Identifies the type of fields:
Vehicle = %New() Engine = %New() Engine->Fuel = "Diesel" Vehicle->Year = 2018 Vehicle->Make = "Suzuki" Vehicle->Emissions = %Array() Vehicle->Engine = Engine Vehicle->Warranty = %Null() Vehicle->Imported = (bool)1 PRINT "This field is of type: ":Vehicle->%Type(Field, "Year") PRINT "This field is of type: ":Vehicle->%Type(Field, "Make") PRINT "This field is of type: ":Vehicle->%Type(Field, "Emissions") PRINT "This field is of type: ":Vehicle->%Type(Field, "Engine") PRINT "This field is of type: ":Vehicle->%Type(Field, "Warranty") PRINT "This field is of type: ":Vehicle->%Type(Field, "Imported") PRINT "This field is of type: ":Vehicle->%Type(Field, "TaxBand")
which produces
This field is of type: number This field is of type: string This field is of type: array This field is of type: object This field is of type: null This field is of type: boolean This field is of type: undefined