I'm trying to use a function with an IF statement to modify the payload on a message but for some reason I can't get the payload to change. I used the switch node to make sure I had the correct path to the array returned by the mysql node and that was fine. But the function just keeps returning the output from the mysql node instead.
It's because neither your if nor your else match.
Add a debug node before this function node to see what is actually in msg.payload.
Alternatively, are an else clause.
S.O.B, I knew it was something simple. I added another else if with <= 3.7 and it's all good now.
I feel stupid now.