Guys this is my example code node red, I am trying to get "hi". I managed to get value for age, but when i deploy the application, nothing shows up about the if statement.
var data= {
"age" : "24",
"hometown" : {"country": "USA",
"City": "Missoula, MT"},
"gender" : "male"
};
node.send( {payload:data.hometown.country});
node.send( {payload:data.hometown.City});
node.send({payload:data});
var s =({payload:data.age});
node.send(s);
if (s == '24'){
node.send("hi");
}
Here is the result
msg.payload : string [3]
USA
6/28/2016, 9:55:17 AM8ae7211a.e3f0b
msg.payload : string [12]
Missoula, MT
6/28/2016, 9:55:17 AM8ae7211a.e3f0b
msg.payload : Object
{ "age": "24", "hometown": { "country": "USA", "City": "Missoula, MT" }, "gender": "male" }
6/28/2016, 9:55:17 AM8ae7211a.e3f0b
msg.payload : string [2]
24
I can see the value for data.hometown.country, city, and age, but my if statement is not working.
Aucun commentaire:
Enregistrer un commentaire