I have an MQTT subscription which outputs parsed JSON into a function that reformats and outputs a message:
- MQTT > Function 'Reformat Message' > Function 'Create SQL' > mySQL connection
The challenge I'm facing is reformatting the JSON date into a mySQL datetime value, I've found the moments formats which is correctly formatting the date but I'm struggling on how to either update the date value or join the data:
-
MQTT > Function Moments > Function 'Reformat Message' > Function 'Create SQL' > mySQL connection *** The moments function only outputs the date and not the original MQTT data
-
MQTT > Function 'Reformat Message' > JOIN >Function 'Create SQL' > mySQL connection
> Function Moments --------------> *** The join is not inserting correctly formatted data
The only way I have managed to get this to work is as follows:
- MQTT > Function 'Reformat Message' > JOIN >Function 'Create SQL' > mySQL connection
> Function Moments > GLOBAL value *** The Create SQL function then uses the GLOBAL value
Is there a better way to achieve what I need to do, reformat date, my concern with my working solution relates to when the GLOBAL value is set, will this be set before the Create SQL is run?