Data Type Overview
When using the Boolean Condition connector to compare two values against each other, data types are an important consideration. In the below example, the Boolean Condition connector is comparing a value of 12000 as a number data type from a Data Storage connector against “12000” as a string. Note that value1 is 12000, but value2 is “12000” — it’s clear these two values aren’t the same data type.
Due to this, the result is false, as different data types are not comparable, so the false branch is taken instead of the expected true branch.
This can be resolved by correcting the data type of one of the values, either by changing it in the Boolean Condition connector directly if the value has been typed in manually, or by utilising a Text Helper to change a value to a different data type before comparison. See both examples below:
Changing data type:
In this example, the 2nd Value’s data type was changed from a string, denoted by an A, to a number, denoted by 123. On the left in the debug log, you can see that because both values were numbers this time, and had the same value of 12000, the true branch was taken.
Using Text Helper:
In this example, the first value, which was originally a number, was changed to a string using a Text Helper connector, and the output of that connector was used as the 1st value input.
On the left in the debug log, you can see that because both values were strings this time, and had the same value of “12000”, the true branch was taken.
Comments
0 comments
Please sign in to leave a comment.