Operation¶
The Operation node parses the measurment point or attribute from the input msg according to the selected message type, performs low-code logic and math operations, and passes it to the downstream node as output msg.
Node Type¶
Transformation.
Input and Output Ability¶
This node has multiple entry points and 1 exit point. Both the input and output are JSON.
Node Properties¶
Name
The name for this node.
Message Type
The message type, either Post Measurement Point or Post Attribute, to perform the operation on.
Model
The model of the message type. You can select only 1 model.
Input Point
The measurement points or attributes (in
), depending on the Message Type selected, of the model selected above which are used together with the Operator under Expression below for calculation (out
). You can select multiple input points.
Output Point
The measurement point or attribute, depending on the Message Type selected, of the model selected above which is used to store the calculated result in Expression. The result will overwrite its existing value. You can only select 1 output point.
Expression
The calculation expression for the output. Click the operator and input points to build the expression.
out
refers to the calculated result that will be stored in Output Point.in
referes to the input point.
Operator |
Formula |
Example |
Remarks |
---|---|---|---|
Abs |
out = abs(in1) |
in1 = -9 out = 9 |
Returns the absolute value of the number.
|
Avg |
out = (in1 + in2) / 2 |
in1 = 7, in2 = 8.7 out = 7.85 |
Returns the average of 2 numbers.
|
Max |
out = max(in1, in2) |
in1 = 3, in2 = 6 out = 6 |
Returns the higher value of the two.
|
Min |
out = min(in1, in2) |
in1 = 3, in2 = 6 out = 3 |
Returns the lower value of the two.
|
Exp |
out = exp(in1) |
in1 = 6 out = 403.4287934927351 |
Returns the exponential function with base e.
|
Modulus |
out = (in1 % in2) |
in1 = 22, in2 = 3 out = 1 |
Returns the remainder after dividing.
|
Power |
out = pow(in1, in2) |
in1 = 3, in2 = 5 out = 243 |
Returns the power (in2) of a number (in1).
|
SquareRoot |
out = sqrt(in1) |
in1 = 64 out = 8 |
Returns the squareroot of the number.
|
And |
out = (in1 && in2) |
|
Returns true only if both values are true.
|
Or |
out = (in1 || in2) |
|
Returns true if one of the values is true.
|
Not |
out = (!in1) |
|
Returns the reverse value.
|
Equal |
out = (in1 == in2) |
|
Returns true if both values are the same.
|
Greater Than |
out = (in1 > in2) |
|
Returns true if in1 is greater than in2.
|
Greater Than Equal |
out = (in1 >= in2) |
|
Returns true if in1 is greater than or equals to in2.
|
Less Than |
out = (in1 < in2) |
|
Returns true if in1 is less than in2.
|
Less Than Equal |
out = (in1 <= in2) |
|
Returns true if in1 is less than or equals to in2.
|
Log10 |
out = lg(in1) |
in1 = 35 out = 1.5440680443502757 |
Returns the base 10 logarithm of the number.
|
LogE |
out = ln(in1) |
in1 = 22 out = 3.091042453358316 |
Returns the natural logarithm of the number.
|
Click the Test button to test your expression by entering the expression to see if it works as designed.
Description
The description for this node.
Limitations¶
Only supports numeric and boolean values.
Samples¶
The samples below are based on the following data.
Input Point:
attribute1
,attribute2
Output Point:
attr_int
Expression:
pow(msg.attribute1, msg.attribute2)
Input Sample¶
{
"MetaData": {
"messageType": "PostAttribute",
"assetId": "assetId",
"deviceKey": "deviceKey",
"productKey": "productKey",
"orgId": "yourOrgId"
},
"Body": {
"attribute1": 3,
"attribute2": 5,
"attr_int": 3
}
}
Output Sample¶
{
"MetaData": {
"messageType": "PostAttribute",
"assetId": "assetId",
"deviceKey": "deviceKey",
"productKey": "productKey",
"orgId": "yourOrgId"
},
"Body": {
"attribute1": 3,
"attribute2": 5,
"attr_int": 243
}
}