CabMasterPro User Guide
In This Topic
    Data Types
    In This Topic
    Each property in CabMasterPro, such as those on the All Answers page, are typed. This means they are stored as a certain class of value, such as a text string or a number. When you add a property to the All Answers page which has a formula, the data type will usually be determined for you. If it cannot be figured out from the formula, its type will be set to "<none>".

    CabMasterPro is loosely typed, which means that values are easily and automatically converted between the different data types. For example, if we have a value of 5 (of data type Whole Number) and a value of "3.2" (String type), then the expression 5 + "3.2" would equal 8.2 (Number type). This is because when the formula is evaluated, each value is converted to the "lowest common denominator" type (Number in this case) if required by the operator. Once both operands are the same type, they can then be added together. Basically what this means is that you do not usually have to worry about which data type variables are. When you have to make sure that a value is a certain type, you can use functions like Value or Text.

    However, the ease of conversion between data types can be easily misunderstood. For example, a string like "yes" will freely convert to a Logical data type with value TRUE. An expression like Or("1","2") expects these two arguments "1" and "2" to be Logical types and first converts to give whole numbers 1 and 2, then converts onward to give TRUE,TRUE (because 0 converts to FALSE and nonzero values convert to TRUE). So it calculates Or(TRUE,TRUE) giving the answer TRUE. This is not a bitwise Or operator, but a Boolean or LOGICAL operator.

    Another area which can cause extra work by the expression evaluator if not understood correctly is the construction of Lookup Tables (qlt's). Do not unnecessarily quote numbers or other constants. Quoting a number will just make the expression evaluator do extra work. For example, "1.2345" will be evaluated giving the number 1.2345 and quoting "Yes" and "No" will evaluate to the constants Yes or TRUE and No or FALSE. (Usually not harmful but wasteful, might as well write TRUE or Yes etc. in the first place.)

    Note that:-

    • these are case independent so you can also write True or true instead of TRUE, and so on.
    • this applies to other basic values like $3.45 or 123.4mm. Again, quoting "$3.45" or "123.4mm" just forces the evaluator to convert from the quoted string giving a Money or Length type.
    Available Data Types
    Data Type Description
    Angle Used for any value with angle units (deg or rad)
    Area Any value with area units (eg sqcm) or two multiplied length units (eg 3.4m x 94cm)
    Array A value enclosed in square brackets (see the Arrays tutorial) or created by an Array function
    Color Another way is to use the predefined constants (like BLACK RED CYAN etc) listed in the Constants section
    Date and Time A full date such as the value of the built-in property Create_DTM (drawing creation date)
    Length Any value with length units (eg metre, inch, etc)
    Lookup Table The filename of a Lookup Table
    Map A sequence of key : value pairs, where key is a string and value is any type. The sequence is comma separated and wrapped in curly brackets. (see the Maps tutorial)
    Money Any value with money units (dollars or cents)
    Number A numerical value, including decimal places
    Point2D A pair of lengths, in brackets, comma separated, representing a point in the xy plane. Starts with Point2D. Example: Point2D(3mm,4mm)
    Point3D Three lengths, in brackets, comma separated, representing a point in the xyz plane. Starts with Point3D. Example: Point3D(3mm,4mm,5mm)
    Rate A value where there are multiple units combined, eg $67/hour or 1.4min/sqm; where you would use the word "per"
    String Any text value, including text representations of other data types
    Time Any value with time units (hour, second, minute)
    Volume Any value with volume units (eg cbft) or an area multiplied by a length
    Whole Number A numerical value which does not include decimals/fractions
    Yes or No A boolean value, ie has only two possible values, regardless of what you call them: yes/no, on/off, true/false, or 1/0


    You can use the middleware functions TypeIndex and TypeName to find the actual type of a given middleware variable. And for some middleware operations, like AddCol, you can use types from the table below to specify the actual type of a column being added to a lookuptable.

    TypeIndex TypeName TypeName as string
    0 TYPE_NONE "<none>"
    1 TYPE_STRING "String"
    2 TYPE_YESORNO "Yes or No"
    3 TYPE_WHOLENUMBER "Whole Number"
    4 TYPE_NUMBER "Number"
    5 TYPE_MONEY "Money"
    6 TYPE_TIME "Time"
    7 TYPE_LENGTH "Length"
    8 TYPE_AREA "Area"
    9 TYPE_ANGLE "Angle"
    10 TYPE_ARRAY "Array"
    11 TYPE_LOOKUPTABLE "Lookup Table"
    12 TYPE_DATEANDTIME "Date and Time"
    13 TYPE_VOLUME "Volume"
    14 TYPE_RATE "Rate"
    15 TYPE_COLOR "Color"
    16 TYPE_MAP "Map"
    17 TYPE_POINT2D "Point 2D"
    19 TYPE_POINT3D "Point 3D"