Built-in function

The SELECT statement supports using built-in functions to obtain device-related constants (case-sensitive function names). The contents returned by built-in functions are string constants, and related insert operations are supported. Please follow the instructions below:

Function Name Description Example Remarks
imei() Get NB device imei number SELECT *,imei() as imei Only NB devices are supported. For other protocol devices, the function returns an empty string "".
bin_data() Get binary data from device messages SELECT *,bin_data() as bin_data Only valid for binary data points uploaded by devices. Extract binary data from data points and convert them to hexadecimal strings. For example, 0x0102 is converted to "0102". For non-binary data points, the function returns an empty string "". Note: The size of binary data points is limited to 80k.
deviceName() Get device name SELECT *,deviceName() as name Get the name of the device that generated the message

Examples of built-in functions are as follows:

Original JSON SQL Statement Result Description
{"a":1} SELECT *,imei() as b {"a":1,"b":"4A7B3123F202"} NB devices
{"a":1} SELECT *,imei() as b {"a":1,"b":""} Null for non-NB devices
{"a":1} SELECT *,bin_data() as b {"a":1,"b":"010203"} Binary data points
{"a":1} SELECT *,bin_data() as b {"a":1,"b":""} Null for non-binary data points
{"a":1} SELECT *,deviceName() as b {"a":1,"b":"mydevice"} -

个搜索结果,搜索内容 “

    0 个搜索结果,搜索内容 “