The parameters received directly from the device can be converted. For this purpose, you should specify the conversion operation in the **Parameter** field of the sensor properties. The situations in which this operation can be applied are described below.

## Bitwise parameter control

Bitwise parameter control allows you to control a specific bit of a parameter. This operation is used if the device shows different data in one parameter: the first bit can correspond to the state of the alarm (on/off), the second to the state of the driver door (open/closed), the third to the state of the headlights, and so on.

The bits are numbered starting from 1 in the monitoring system. To control, for example, the third bit of the parameter **param199**, type a colon and the bit number after its name:

param199:3

In this way, you can create several sensors on the basis of one parameter to control different bits.

The parameters of the **double** type are automatically converted into the **int **type, after which a bit is retrieved.

Bitwise parameter control can be also applied to 64-bit parameter values, but consider the following particularity. When displaying a number with the 64th bit filled, this bit is regarded as a minus sign for the number contained in the remaining 63 bits. Thus, parameter values greater than (2^63 - 1) = 9223372036854775807 are displayed as negative ones.

For more information, see **Sensors: Working with Bits** .

## Conversion of text parameters

If a sensor has an expression parameter which contains a text parameter, then the text value is converted to a 53-bit integer. By default, this value is considered decimal. If the value belongs to another numeral system, enter a colon after the text parameter and specify this numeral system. Thus, the value will be converted to the decimal system automatically. For example, if the parameter **text_param **sends the value 100, then

text_param = 100 text_param:10 = 100 text_param:16 = 256 text_param:2 = 4

## Determination of the day number in a year

You can convert the UNIX time of the message to the day number relative to January 1st. To do this, create a custom sensor with the parameter **time:d**.

For example, for 11:00:00 (UTC) March 28, 2017, the UNIX time is 1490698800. Therefore,

time = 1490698800 time:d = 87

## Conversion of the driver, trailer and passenger sensor parameters

Conversion of text and numerical parameter values is available for the sensor types **Driver assignment**, **Trailer assignment** and **Passenger sensor**. To convert a parameter value, you must specify an expression in the **Parameter **field of the sensor properties, which can include functions and mathematical operations.

Functions can only apply to text values, while mathematical operations apply to numeric ones.

Converted values are used as follows:

- when driver, trailer or passenger assignment notifications are triggered;
- in unit tooltips and extended information;
- in data messages ;
- in reports, for example, in the
**Sensor tracing**table in the column**Formatted value**.

### Functions

The functions apply only to text values of the parameters. Their description is in the table below, where **param** is the name of the parameter in which the device sends the text value.

Function | Description | Example of the value before | Example of the value after |
---|---|---|---|

ltrim(param) or ltrim(param,'0') | Trims all zeros to the left. By default, '0' is trimmed, but it can be applied to other characters as well. The character is specified in single quotes. | 0000A | A |

rtrim(param) or rtrim(param,'0') | Trims all zeros to the right. By default, '0' is trimmed, but it can be applied to other characters as well. The character is specified in single quotes. | A0000 | A |

lower(param) | Converts characters to lowercase. | A | a |

upper(param) | Converts characters to uppercase. | a | A |

reverse(param) | Reverses the characters order. | A1234 | 4321A |

reverseb(param) | Reverses the order of characters by two. If a string has an odd number of characters, it is first appended with a leading zero to the left, and then the string is reversed. | C1B2A | 2A1B0C |

lfill(param,5,'0') | Adds the specified character (third function parameter) to the left until the string contains the required number of characters (second function parameter). The added character is specified in single quotes. | A | 0000A |

rfill(param,5,'0') | Adds the specified character (third function parameter) to the right until the string contains the required number of characters (second function parameter). The added character is specified in single quotes. | A | A0000 |

sequence(param,2,3,5,4,1,0,1414) | Changes the sequence of the characters. The characters are arranged in the order specified after the parameter name. If a non-existent index is specified, 0 is put in place of that character. The indices are counted from left to right, starting from 0. | 0C1B2A | 1BA2C00 |

hex(param) | Converts from the decimal system to the hexadecimal one. | 10 | a |

dec(param) | Converts from the hexadecimal system to the decimal one. | 00A | 10 |

hextoascii(param) | Converts from hexadecimal to ASCII. | 3A29 | :) |

concat(param,substr(param,1,4),'00') | Sticks strings together. More than two strings can stick together. In the example, it is used together with the The characters are specified in single quotes. | 0C1B2AD35E | 0C1B2AD35EC1B200 |

substr(param,1,4) | Extracts specified characters from the parameter value. The extracted characters make a substring. There are 3 mandatory parameters for the function: - source string,
index from which the searched substring starts, - length of the searched substring, that is. how many characters should be extracted.
The indices are counted from left to right, starting from 0. The extracted substring can be combined with another string using the | 0C1B2AD35E | C1B2 |

len(param) | Returns a number that specifies the number of characters in the string. You can perform mathematical operations on the result because it is a number. For example, the expression | 0C1B2AD35E | 10 |

### Mathematical operations

Mathematical operations of addition (+) and subtraction (-) are possible only with numeric values. With text values they are possible only after their conversion into numeric values (see the example for the **len ** function above).

If one of the elements in an expression with a mathematical operation is not numeric, the result will show 0.