Hello
i have a function node writing
msg.payload = {
status: msg.payload.crc_error
}
return msg;
the Output if error, is then status: false
is there a way to on the fly
msg.payload.crc_error if false write "CRC Error" else write the output
so the output message would then be CRC Error
have a nice day
vinc
E1cid
18 June 2021 14:38
2
try
msg.payload = {
status: (msg.payload.crc_error ? msg.payload.crc_error : "CRC Error")
}
[edit]
thinking about it this would be better
msg.payload = {
status: (msg.payload.crc_error || "CRC Error")
}
fast @E1cid thanks a lot
looks spezial - will add it and wait
@E1cid thanks for your sugestion
i try to understand what will happen
if the output status: false it will write CRC Error
what happen it it write status: true would it be possible to have OK?
have a nice day
vinc
Long hand (for clarity)...
if (msg.payload.crc_error == false)
msg.payload.status = "CRC OK"; //or whatever message you want
} else {
msg.payload.status = "CRC Error"; //or whatever message you want
}
return msg;
Shorthand hand ...
msg.payload.status = msg.payload.crc_error == false ? "CRC Error" : "CRC OK";
return msg;
thanks for the long Hand @Steve-Mcl now it is more clear to me.
E1cid
20 June 2021 09:05
7
Just replace msg.payload.crc_error with "OK"
eg
msg.payload = { status: (msg.payload.crc_error ? "OK" : "CRC Error") }
Merci, @E1cid & @Steve-Mcl for your help and clarification.
Changed - and have to wait till message arrive it not a message flow more some message drops
system
Closed
19 August 2021 09:27
9
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.