Type Conversion

When CBFS Vault parses a query, it will attempt to convert operands to the same type before evaluating an expression. The right-hand operand is converted to match the type of the left-hand operand if possible; otherwise, if the right-hand operand is of the String type, the left-hand operand is converted to String.

Supported Data Type Conversions

Convert To Convert From Notes
String Number, Boolean, NULL Typical conversion rules apply; Boolean values become "True" or "False".
String DateTime The format string used by the conversion is YYYY-MM-DD hh:mm:ss.fff.
Boolean String "True" and "False" are the recognized string values.
DateTime String The parsing pattern used by the conversion is YYYY[-]MM[-]DD[[tT ]hh[[:]mm[[:]ss[.fff]]]]; see notes below.
Number String The conversion recognizes numbers formatted as signed base-10 integers.

In addition to the implicit conversion mentioned above, a String can be converted to a DateTime explicitly using the intrinsic function D(value). The implicit and explicit conversions both use the parsing pattern shown above, which has a number of optional parts:

  • The date separators - may be omitted if the month and day are both two-digit values. They must both be present if the month and/or day is a single-digit value.
  • The time portion may be omitted; if present, it must be specified as one of the following: hours only; hours and minutes; hours, minutes, and seconds; or hours, minutes, seconds, and milliseconds.
    • The time separators : may be omitted if all included time elements are two-digit values. They must be present if any time elements are single-digit values.
    • Milliseconds, if present, must always be separated by a . character, and must always be a three-digit value.
  • When the time portion is present, it may immediately follow the date portion (i.e., with no separator), or it may be separated from the date portion using a T, a t, or a single space.

Copyright (c) 2022 Callback Technologies, Inc. - All rights reserved.
CBFS Vault 2020 Qt Edition - Version 20.0 [Build 8145]