Analytics Builder 10.14.0 | Using Analytics Builder for Cumulocity IoT | Wires and Blocks | Type conversions
 
Type conversions
It is legal to connect a block output to a block input if they are the same type. Most other connections are also permissible, which result in the conversions as described in the table below. An X indicates that a connection is not legal; trying to deploy a model with such a wiring connection will fail.
From block with output type
pulse
boolean
float
string
any
Connect to input of type
pulse
connection is legal
pulse occurs when output changes to true
pulse occurs when output changes value
pulse occurs when output changes value
pulse occurs when output changes value (excluding changes to false)
boolean
true when the pulse has occurred, otherwise false
connection is legal
true if non-zero
true if not an empty string
true if value non-zero/empty
float
connection is not legal
0 for false, 1 for true
connection is legal
connection is not legal
permitted if the value is of type float or boolean, other values fail at runtime
string
connection is not legal
"true" or "false"
number converted to a string (may be in scientific notation)
connection is legal
string value (may be in scientific notation)
any
connection is legal
connection is legal
connection is legal
connection is legal
connection is legal
Only conversions that will always succeed are allowed. String values are not converted to float values; while the input conversion may work sometimes, it cannot be guaranteed to always work.
In many cases, you need not worry about type conversions and where a wire makes sense. Any type conversion that is needed happens automatically.
Some blocks accept different types of inputs, and may change their output type or behavior depending on the input types. For example, the logical OR block can operate on either Boolean or pulse inputs, and its output is the same as its input types.
In some cases, it is desirable to force a value to be interpreted as a specific type, in which case a converter block can be used to force a conversion to a specific type. For example, the Pulse block can convert Boolean or float values to pulses, according to the conversions above. This means: for Boolean, generate a pulse when the Boolean value changes to true; for float, generate a pulse when the value changes. Thus, connecting two float outputs to an OR block directly will generate a Boolean output which is true when either of the float outputs is non-zero. Alternatively, connecting two float outputs each to a Pulse block and from them to the inputs of an OR block, will send a pulse whenever either float output changes value. This is the default behavior of the Pulse block.
Different types of pulse conversions are possible with the Pulse block, depending on the setting of its Mode parameter. The conversions in the different modes are described in the table below:
From block with output type
pulse
boolean
float
string
any
Connect to Pulse block in mode
On value change (default)
connection is legal
pulse occurs when output changes to true
pulse occurs when output changes value
pulse occurs when output changes value
pulse occurs when output changes value (excluding changes to false)
On every input
connection is legal
pulse occurs on every input
pulse occurs on every input
pulse occurs on every input
pulse occurs on every input
On non-zero values
connection is legal
pulse occurs on every true input
pulse occurs on every non-zero input
pulse occurs on every non-empty input
pulse occurs depending on value's type as described in cells to the left