Value Equal
Description
This object is being used to compare two values of any data type with each other. The object will try to convert the incoming values to a common message type and perform the comparison.
App Builder Object
Source Code
function execute() {
let signalA, signalB;
if(inPorts[1].signalType.key === inPorts[2].signalType.key) {
// Do not try to convert if already the same
signalA = inPorts[1];
signalB = inPorts[2];
} else {
if(IsConversionPossible(inPorts[1], inPorts[2])) {
signalA = inPorts[1];
signalB = inPorts[2];
} else if (IsConversionPossible(inPorts[2], inPorts[1])){
signalA = inPorts[2];
signalB = inPorts[1];
} else {
// No conversion possible between signal types
// so they can not be equal
return [false, true];
}
signalA = convertMessageToSignalType(signalA, signalB.signalType, ApplicationId);
}
if (signalA.equals(signalB)) {
return [true, false];
}
return [false, true];
}
Examples
Example | Trigger | Value 1 | Value 2 | Equal | Not Equal |
---|---|---|---|---|---|
1 | Trigger | 10 | 10 | true | false |
2 | Trigger | 4 | “Test“ | false | true |
In Ports
Position | Name | Message Type | Description |
---|---|---|---|
1 | Start | Trigger | This port is being used to trigger the 'Value Equal' object. |
2 | Value 1 | Any | This port is being used to receive value 1 for the ‘Value Equal'. |
3 | Value 2 | Any | This port is being used to receive value 2 for the ‘Value Equal'. |
Out Ports
Position | Name | Message Type | Description |
---|---|---|---|
1 | Equal | Digital | This port is being used to show if the values are equal for the 'Value Equal'. |
2 | Not Equal | Digital | This port is being used to show if the values are not equal for the 'Value Equal'. |
Properties
Name | Description |
---|---|
Object Name | The name on the object on the canvas. |
Show Code View | The switch to turn on code view for the Code Object. |
Duplicate Code into custom Code Object |