Struggling to understand how to use a switch node to switch based on the content of a RowDataPacket returned from a SQL Select in a Function Node.
The output from the SQL Select is always a single name / value object (array).
[ RowDataPacket { access: 1 } ]
and access will either be 0 or 1.
The logic is simple, activate output 1 if access = 1
I have ready many posts and some seem to suggest that I need a split node or another function node to split the array before passing the value to the switch node Is this true?
Regards Ralph
You probably want something like this:
Where you explicitly point to the access field on the first object in the incoming array.
But if you are running SQL queries in the function node, then you should be able unpack this to just set msg.payload
to the value before calling return msg
anyway.