Hey guys,
I've written a code block inside a function which should read a flow variable called selected_symbol and writes out a msg.topic. I have made sure that selected_symbol is properly filled with a string (e.g. "IDR.ES"). Still the function only returns an empty msg.topic:
msg.topic = `INSERT INTO TRADE_DATA.ORDERS (SYMBOL, CREATED_TIME)
VALUES(
\"` & flow.get('selected_symbol') & `\",
FROM_UNIXTIME(UNIX_TIMESTAMP())
");`
node.error("Error! msg.topic = " & msg.topic);
return msg;
As mentioned node.error(..) returns "Error! msg.topic = " - that's it.
(For brevity I'm highlighting only a shortened insert statement).
Also, for this string I'm using ` characters in order to be flexible when using ' or " in my SQL statement.
I have tried with ${flow.selected_symbol} and $flowContext('selected_symbol') but neither are recognized.
Can anyone enlighten me what I'm doing wrong?