Product Documentation

MQTT V3 Plug-in Reference

Previous Topic

Next Topic

"propertyFormat"

The property called "propertyFormat" defines the format of the value in a JSON property, XML element, etc.

  • String
  • Required for JSON properties that represent other data types.

The value depends on the type of the JSON property and the "fieldType".

  • FairCom Edge uses "propertyFormat" to specify how to interpret and transform a JSON property value before it stores the value into a field in a table.
  • FairCom Edge provides built in formats that make it easy to transform JSON values into the desired field type.
  • Example: A date and/or time can be embedded in a JSON string, such as "12/01/2002" and "8:15:30 PM". A date and/or time can also be represented as a JSON number. This number typically represents a date and/or time based on days or seconds that are offset from a starting point in time, such as 18256.33. FairCom Edge needs to know how to convert the value before storing it in a date and/or time field.
  • Example: A floating point number in a JSON property may be assigned to an Integer field and FairCom Edge needs to know how to truncate or round the number.
  • Example: JSON has no native support for binary values and there are multiple ways to store binary values in strings and arrays, such as embedding Base64 or hexadecimal encoded values in a string, such as "SGVsbG8gV29ybGQ=" and "FF003D". A binary value can also be represented as a JSON array of numbers, such as [0,1,99,100,255].

Formats for binary fields: BINARY, VARBINARY, and LVARBINARY

  • "BYTE_ARRAY"
    • This is the default value for binary fields.
    • It requires a JSON property to be assigned to an array of numbers where each number is between 0 and 255 and represents one byte, such as [0,1,99,100,255].

Format for BASE64 fields

  • "BASE64" causes FairCom Edge to convert a base64-encoded value in a string into a binary value, which it stores in the specified table field.
  • "Base64" is not case-sensitive.

    Configuration Message Example

    {

    "operation": "CreatePersistenceTopic",

    "persistenceTopic": "myTopic",

    "tableName": "table1",

    "mapOfPropertiesToFields":

    [

    {

    "propertyPath": "image1",

    "propertyFormat": "BASE64",

    "fieldName": "myBinaryField",

    "fieldType": "LVARBINARY",

    "fieldWidth": 15

    }

    ]

    }

    Data Message Example

    { "image1": "SGVsbG8gV29ybGQ=" }

    table1 - Result Example:

    myBinaryField

    0xFF003D

Format for HEX fields

  • "HEX" causes FairCom Edge to convert a hexadecimal-encoded value in a string into a binary value, which it stores in the specified table field.
  • "hex" is not case-sensitive.

    Configuration Message Example

    {

    "operation": "CreatePersistenceTopic",

    "persistenceTopic": "myTopic",

    "tableName": "table1",

    "mapOfPropertiesToFields":

    [

    {

    "propertyPath": "image1",

    "propertyFormat": "HEX",

    "fieldName": "myBinaryField",

    "fieldType": "VARBINARY",

    "fieldWidth": 15

    }

    ]

    }

    Data Message Example

    { "image1": "0xFF003D" }

    table1 - Result Example

    myBinaryField

    1111 1111 0000 0000 0011 1101

Formats for integer fields: TINYINT, SMALLINT, INTEGER, and BIGINT

  • "TRUNCATE"

    This is the default value for binary fields. It truncates a JSON floating point number when assigning to an integer field.

Formats for date fields: DATE

  • "MM.DD.CCYY" — 12/01/2002, 12-01-2002, etc. This is the default date format.
  • "MM.DD.YY" — 12/01/02, 12.01.02, etc.
  • "DD.MM.CCYY" — 01/12/2002, 01_12+2002, etc.
  • "DD.MM.YY" — 01/12/02, 01 12 02, etc.
  • "CCYYMMDD" — 20021201
  • "YYMMDD" — 021201

Formats for time fields: TIME

  • "hh.mm.ss.am/pm" — 8:15:30 PM, 08.15.30 pm, etc. This is the default time format.
  • "hh.mm.am/pm" — 8:15 pm, 08 15 P, etc.
  • "hh.mm.ss" — 20:15:30, 20.15&30, 20H15M30S
  • "hh.mm" — 20:15
  • "hhmm" — 2015

Formats for timestamp fields: TIMESTAMP

  • No TIMESTAMP formats are currently supported.

TOCIndex