Trying to make a calculation in NR using Join to create an array and then do a division in a calculator node.
Everything works as expected if the values (numerator and denominator) arrives in the correct order but they don't always do.
Setting a delay on one input feels like a bad work around.
Is there anyway to get them sorted in the join node?
Been looking a msg.part.index without luck but was not really knowing what I was doing.
Made a simple flow to illustrate the issue.
I will get different values depending on what I inject first since I'm doing a division.
I need it to always sort upper value as numerator and the lower as denominator.
The flow:
[{"id":"9a11d6ef7f86328c","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"2e221b1.51df8e4","type":"inject","z":"9a11d6ef7f86328c","name":"numerator","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0.5","payloadType":"num","x":480,"y":400,"wires":[["9d63e1180abe6daf"]]},{"id":"10bd8f79.53bee9","type":"inject","z":"9a11d6ef7f86328c","name":"denominator","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":490,"y":440,"wires":[["9d63e1180abe6daf"]]},{"id":"9d63e1180abe6daf","type":"join","z":"9a11d6ef7f86328c","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":670,"y":420,"wires":[["884d77d6bc170327"]]},{"id":"884d77d6bc170327","type":"calculator","z":"9a11d6ef7f86328c","name":"","inputMsgField":"payload","outputMsgField":"payload","operation":"div","constant":"","round":false,"decimals":0,"x":810,"y":420,"wires":[["8a73976f9414d377"]]},{"id":"8a73976f9414d377","type":"debug","z":"9a11d6ef7f86328c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":970,"y":420,"wires":[]}]