Data Types


Macro Expert supports 5 primitive data types: Text, Number, Datetime, Binary and Boolean.

  • Text

    Known as string, holds a sequence of characters. In an expression, the string data must be enclosed by the single or double quotation marks. You may use \' to represent the single quotation sign its self, and use the \" to represent the double quotation sign.

    Example 1:

    %'He is a student.'%

    The string data type supports + operator and - operator.

    Example 2:

    %="abc"+"bcd"%
    ' The preceding expression evaluates to "abcbcd".

    Example 3:

    %="abcd"-"bc"%
    ' The preceding expression evaluates to "ad".

    NOTE the backslash is used as an escape character in a text, to indicate that the character following it should be treated specially or normally.  For instance inside a quoted text the sequence \n produces a newline character instead of an 'n'.  The double backslash sequence \\ produces a normal literal backslash.

    Example 4:

    %"He said: \"No\""%
    ' The preceding expression evaluates to "He said: "No"".

    Example 5:

    %"c:\\folder A\\folder B\\file"%
    ' The preceding expression evaluates to "c:\folder a\folder b\file". The double-backslash represents the to represent the literal backslash.

    To prevent from string escaping, you would use the verbatim string literal. A verbatim string literal consists of an @ character followed by a quotation mark, zero or more characters, and a closing quotation mark.

    Example 6:

    %@'c:\folder a\folder b\file'%
    ' The preceding expression evaluates to "c:\folder a\folder b\file".

    Example 7:

    %@'test\' test"%
    ' The preceding expression evaluates to "test\' test".

  • Number

    Holds signed IEEE 64-bit (8-byte) double-precision floating-point numbers ranging in value from -1.79769313486231570E+308 through -4.94065645841246544E-324 for negative values and from 4.94065645841246544E-324 through 1.79769313486231570E+308 for positive values. Double-precision numbers store an approximation of a real number.

    Example 1:

    %=1+20%
    ' The preceding expression evaluates to "21".

    Example 2:

    %=0x10 \ 3%
    ' The preceding expression evaluates to "1".

    In an expression, you may use the hexadecimal notation (prefixed with 0x)to represent a number.

    Example 3:

    %=v_val + 0x2A%

  • Datetime

    Holds a date and time value. The datetime supports + operator, - operator, * operator, / operator. In an expression, the datetime value must be quoted by the number sign #.

    Example 1:

    %=#2007-08-10#+1%
    ' The preceding expression evaluates to 2007-08-11.

    Example 2:

    %=#2007-08-10#-8%
    ' The preceding expression evaluates to 2007-08-02.

  • Binary

    Holds the binary data of any kind. This data type is used to represent a structural data for the instruction "Call an External DLL", it can also be used to store an image data.

    For reading the content in a binary data, you could use the action "Advanced Get Variable Value".

  • Boolean

    The boolean data type has only two possible values: TRUE and FALSE. Use this data type for simple flags that track true/false conditions. A boolean value in the expression is presented by the string TRUE and FALSE.

    Example A:

    %=( v_val = TRUE )%

Additional References