Guys,
I have a switch node looking a value in a Context Object and when i do a (what i thought was a straight string comparison for ==) it does not match - when i change the switch to contains - it does match
I have checked with the vendor and they are not adding spaces - and when i copy the value into a text editor there do not appear to be and leading/trailing space - any ideas ?
If i change the contains to == it does not match on either value
Craig
your variable is BOOLEAN not a string ... you have to use below instead
Hmm I assumed it was coming in as a string but you are saying it is being turned into a boolean - or just that NR treats all of true/false as boolean
You have check your payload object to determine the field types.
boolean : true / false (no "true" or "false")
string: whenever there are " " than you have strings
numbers : any number INT or FLOAT
example:
estimate: "FALSE" = string
estimate: false = boolean
estimate: 0 = number (not false)
estimate: 1 = number (not true)
estimate: "0" = string
the entire data stream may be received as a STRING but is getting changed into a object with different field types
Yep I have and it is flagged by the provider as text and appears as that in the object - guess NR just makes some assumptions based on field content
Your data stream is most likely a string formated according JSON-format, which clearly defines the data type (no assumptions from NR ) .. I often use this link to analyse/test JSON strings
JSON-String:
JSON-string (formatted):
object:
your object was clearly described by the JSON format (converted into object)
2 Likes
Thanks guys
Had not looked at the system in so long (testament to NR !) that i was rusty - indeed it is a boolean - thanks for the suggestions
Craig
Hey Craig.
Just in passing, and reading your question.
You said msg.payload[0].estimate
and checking if it is true
.
The second picture is the payload.
Wouldn't it be msg.payload[0].trafficInformation.estimate
?
Sorry, just wondering.
Looked again.... Forget it. I'm stupid.