Hi everyone. I have a problems about how payload collect multiple flow data?
I have tried join node and I dont know why I cannot get the information. The flow like below.
`[{"id":"55eda2de.25396c","type":"switch","z":"c1b977c7.6f56e8","name":"","property":"IntegerTag1","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":90,"y":680,"wires":[["4094b09a.5bed6","49be1e7a.982ba","c09cc593.ac4318"],[]]},{"id":"44311bb0.b22104","type":"join","z":"c1b977c7.6f56e8","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":550,"y":580,"wires":[["a6a5d5a3.c12f28"]]},{"id":"195431a5.3bc84e","type":"inject","z":"c1b977c7.6f56e8","name":"","topic":"","payload":"","payloadType":"date","repeat":"3","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":500,"wires":[[]]},{"id":"3e1f132b.b1245c","type":"debug","z":"c1b977c7.6f56e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":710,"y":580,"wires":[]},{"id":"a6a5d5a3.c12f28","type":"function","z":"c1b977c7.6f56e8","name":"last","func":"boolean = msg.IntegerTag1\nabc=msg.payload;\nvar output ={abc}\n Activees = context.get('temporaryy');\n if(boolean=== 1 && boolean != Activees) {\n context.set('temporaryy', boolean);\n msg={payload:{output}};\n }else return null;\n\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":520,"wires":[["3e1f132b.b1245c"]]},{"id":"4094b09a.5bed6","type":"function","z":"c1b977c7.6f56e8","name":"Active or Off(main_fail)","func":"d = new Date();\nhour = d.getHours();\nminute = d.getMinutes();\nsecond = d.getSeconds();\nyear = d.getFullYear();\nmonth = d.getMonth() +1;\nday = d.getDate();\nboolean = msg.IntegerTag1;\nUp_Down = msg.decimalTag1;\nstrings = msg.stringTag1;\n\nif((strings === \"main_fail\")&&(boolean === 0 || boolean === 1)){\n Actives = context.get('temporary');\n if(boolean === 1 && boolean != Actives) {\n context.set('temporary', boolean);\n msg={payload:{index:\"101\",\n type:\"Active\",\n cat:\"Alarm\",\n tag:\"main_fail\",\n description:\"Main Power Fail\",\n start_date:{year:year,month:('0'+month).slice(-2),day:('0'+day).slice(-2)},\n start_time:{hour:('0'+hour).slice(-2),minute:('0'+minute).slice(-2),second:('0'+second).slice(-2)},\n end_date:{year:-9999,month:-9999,day:-9999},\n end_time:{hour:-9999,minute:-9999,second:-9999},\n related_data:{on_data:{upstream:Up_Down,downstream:Up_Down},off_data:{upstream:-8888.88,downstream:-8888.88}}\n }};\n }else{\n msg={payload:\"null\"}\n }\n}else{\n msg={payload:\"null\"}\n }\n\nreturn msg; ","outputs":1,"noerr":0,"x":360,"y":580,"wires":[["44311bb0.b22104"]]},{"id":"49be1e7a.982ba","type":"function","z":"c1b977c7.6f56e8","name":"Active or Off(s_estop)","func":"d = new Date();\nhour = d.getHours();\nminute = d.getMinutes();\nsecond = d.getSeconds();\nyear = d.getFullYear();\nmonth = d.getMonth() +1;\nday = d.getDate();\nboolean = msg.IntegerTag1;\nUp_Down = msg.decimalTag1;\nstrings = msg.stringTag1;\n\nif((strings === \"s_estop\")&&(boolean === 0 || boolean === 1)){\n Active = context.get('temporarys');\n if(boolean === 1 && boolean != Active) {\n context.set('temporarys', boolean);\n msg={payload:{index:\"100\",\n type:\"Active\",\n cat:\"Alarm\",\n tag:\"s_estop\",\n description:\"Gate E Stop Pressed\",\n start_date:{year:year,month:('0'+month).slice(-2),day:('0'+day).slice(-2)},\n start_time:{hour:('0'+hour).slice(-2),minute:('0'+minute).slice(-2),second:('0'+second).slice(-2)},\n end_date:{year:-9999,month:-9999,day:-9999},\n end_time:{hour:-9999,minute:-9999,second:-9999},\n related_data:{on_data:{upstream:Up_Down,downstream:Up_Down},off_data:{upstream:-8888.88,downstream:-8888.88}}\n }};\n }else{\n msg={payload:\"null\"}\n }\n}else{\n msg={payload:\"null\"}\n }\n\nreturn msg; ","outputs":1,"noerr":0,"x":361,"y":615,"wires":[["44311bb0.b22104"]]},{"id":"c09cc593.ac4318","type":"function","z":"c1b977c7.6f56e8","name":"Active or Off(upsensor_fail)","func":"d = new Date();\nhour = d.getHours();\nminute = d.getMinutes();\nsecond = d.getSeconds();\nyear = d.getFullYear();\nmonth = d.getMonth() +1;\nday = d.getDate();\nboolean = msg.IntegerTag1;\nUp_Down = msg.decimalTag1;\nstrings = msg.stringTag1;\n\nif((strings === \"upsensor_fail\")&&(boolean === 0 || boolean === 1)){\n upsensor_fail_Active = context.get('upsensor_fail_Active_temporarys');\n if(boolean === 1 && boolean != upsensor_fail_Active) {\n context.set('upsensor_fail_Active_temporarys', boolean);\n msg={payload:{index:\"130\",\n type:\"Active\",\n cat:\"Alarm\",\n tag:\"upsensor_fail\",\n description:\"Gate Upstream Sensor Fail\",\n start_date:{year:year,month:('0'+month).slice(-2),day:('0'+day).slice(-2)},\n start_time:{hour:('0'+hour).slice(-2),minute:('0'+minute).slice(-2),second:('0'+second).slice(-2)},\n end_date:{year:-9999,month:-9999,day:-9999},\n end_time:{hour:-9999,minute:-9999,second:-9999},\n related_data:{on_data:{upstream:Up_Down,downstream:Up_Down},off_data:{upstream:-8888.88,downstream:-8888.88}}\n }};\n }else if(boolean === 0 && boolean != upsensor_fail_Active) {\n context.set('upsensor_fail_Active_temporarys', boolean);\n a = msg.upsensor_fail[0];\n msg={payload:{index:\"130\",\n type:\"Off\",\n cat:\"Alarm\",\n tag:\"upsensor_fail\",\n description:\"Gate Upstream Sensor Fail\",\n start_date :{year:a.start_date_year, month:a.start_date_month, day:a.start_date_day},\n start_time :{hour:a.start_time_hour, minute:a.start_time_minute, second:a.start_time_second},\n end_date:{year:year,month:('0'+month).slice(-2),day:('0'+day).slice(-2)},\n end_time:{hour:('0'+hour).slice(-2),minute:('0'+minute).slice(-2),second:('0'+second).slice(-2)},\n related_data:{on_data :{upstream:a.on_data_upstream, downstream:a.on_data_downstream},off_data:{upstream:Up_Down,downstream:Up_Down}}\n }};\n }else{\n msg={payload:\"null\"}\n }\n}else{\n msg={payload:\"null\"}\n }\nreturn msg; ","outputs":1,"noerr":0,"x":382,"y":652,"wires":[["44311bb0.b22104"]]}]`
I would like the output is “null,data,null”.
Before try the join node I also has tried the array and combine all the payload together. The payload cannot collect all the data.
I’m so sorry that I will reply late.
TQVM.