TypeError: Cannot read property 'push' of undefined

i had this error msg "TypeError: Cannot read property 'push' of undefined" i use a serial in to use it with a dropdown but nothings works good iwas blocked with this erorr

exemple of datat:
{"payload":"CE3PRO~4.GCO 4946323\r\n","port":"COM7","_msgid":"427cf766.654478"}
{"payload":"CE26C6~1.GCO 1305369\r\n","port":"COM7","_msgid":"7adfe1f3.b5ae3"}
{"payload":"CE3PRO~1.GCO 7003983\r\n","port":"COM7","_msgid":"831a838d.2e498"}

[{"id":"d88d7327.df59c","type":"serial in","z":"236861.38a5b7a","name":"","serial":"d47dab87.de9298","x":50,"y":880,"wires":[["61b2e6f8.f68a88","34592559.b9a7ea"]]},{"id":"43ddb09d.4c403","type":"ui_button","z":"236861.38a5b7a","name":"","group":"fbe44ce1.d7606","order":1,"width":0,"height":0,"passthru":false,"label":"Initialiser la carte SD","tooltip":"","color":"Black","bgcolor":"pink","icon":"fa-list-ul","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":940,"y":1040,"wires":[["19ccd971.831897","f4ccbc70.4d08b"]]},{"id":"19ccd971.831897","type":"function","z":"236861.38a5b7a","name":"tf","func":"msg.payload = \"M21\\n\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1170,"y":1040,"wires":[["e3810c43.3e236","111554ab.20ee6b"]]},{"id":"74c5d1a5.8fb54","type":"ui_dropdown","z":"236861.38a5b7a","name":"","label":"list","tooltip":"","place":"Select option","group":"fbe44ce1.d7606","order":2,"width":0,"height":0,"passthru":true,"multiple":false,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"topic","topicType":"msg","x":910,"y":1120,"wires":[["94fa3166.8a55c"]]},{"id":"e3810c43.3e236","type":"delay","z":"236861.38a5b7a","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1340,"y":1040,"wires":[["89738db8.c4179"]]},{"id":"89738db8.c4179","type":"function","z":"236861.38a5b7a","name":"","func":"flow.set =(\"recevoirSignal\",1)\nmsg.payload = \"M20\\n\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1500,"y":1040,"wires":[["111554ab.20ee6b"]]},{"id":"34592559.b9a7ea","type":"switch","z":"236861.38a5b7a","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":".GCO","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":170,"y":1120,"wires":[["f6fc16db.338368","65267da.3d97d84"]]},{"id":"94fa3166.8a55c","type":"function","z":"236861.38a5b7a","name":"fichierChoisi","func":"flow.set =(\"fichierChoisi\",msg.payload);","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1330,"y":1120,"wires":[[]]},{"id":"65267da.3d97d84","type":"debug","z":"236861.38a5b7a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":510,"y":1040,"wires":[]},{"id":"f6fc16db.338368","type":"function","z":"236861.38a5b7a","name":"append list ","func":"fichiers=[];\nfichiers = flow.get(\"fichiers\");\nmsg.options.push(msg.payload);\nmsg.options = fichiers;\nflow.set(\"fichiers\",fichiers);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":470,"y":1120,"wires":[["74c5d1a5.8fb54"]]},{"id":"f4ccbc70.4d08b","type":"function","z":"236861.38a5b7a","name":"raz de list","func":"flow.set=(\"fichiers\",[\"Select Option\"]);\n msg.options = [\"derfghj\"];\n return msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1180,"y":1080,"wires":[["74c5d1a5.8fb54"]]},{"id":"d47dab87.de9298","type":"serial-port","serialport":"COM7","serialbaud":"115200","databits":"8","parity":"none","stopbits":"1","waitfor":"","dtr":"none","rts":"none","cts":"none","dsr":"none","newline":"\\n","bin":"false","out":"char","addchar":"","responsetimeout":"10000"},{"id":"fbe44ce1.d7606","type":"ui_group","name":"Impression","tab":"871a5df8.1826a","order":2,"disp":true,"width":"8","collapse":false},{"id":"871a5df8.1826a","type":"ui_tab","name":"Controle","icon":"fa-cog","disabled":false,"hidden":false}]

Posting a massive flow like that is not helpful, as we have no idea where the error is happening.
First see which node is generating the error. If you click on the heading line of the error in the debug pane it should take you to the node. Even better is if you give all nodes names, then the error will have the name at the top. Then connect a debug node showing what is going into the node generating the error and check that the contents are what you expect. If you can't see the problem then post the debug node output and show us how you have configured the node generating the error. If it is a function node then copy/paste the text of the function here. Use the </> button when pasting it in. Before posting it have a look and see where you are using push() in the function. The error probably means that the object you are calling it on does not have a value.

I´m so sorry i think i select the right nodes the problem is on the function named append list [{"id":"d88d7327.df59c","type":"serial in","z":"236861.38a5b7a","name":"","serial":"d47dab87.de9298","x":50,"y":880,"wires":[["61b2e6f8.f68a88","34592559.b9a7ea"]]},{"id":"43ddb09d.4c403","type":"ui_button","z":"236861.38a5b7a","name":"","group":"fbe44ce1.d7606","order":1,"width":0,"height":0,"passthru":false,"label":"Initialiser la carte SD","tooltip":"","color":"Black","bgcolor":"pink","icon":"fa-list-ul","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":940,"y":1040,"wires":[["19ccd971.831897","f4ccbc70.4d08b"]]},{"id":"19ccd971.831897","type":"function","z":"236861.38a5b7a","name":"tf","func":"msg.payload = \"M21\\n\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1170,"y":1040,"wires":[["e3810c43.3e236","111554ab.20ee6b"]]},{"id":"74c5d1a5.8fb54","type":"ui_dropdown","z":"236861.38a5b7a","name":"","label":"list","tooltip":"","place":"Select option","group":"fbe44ce1.d7606","order":2,"width":0,"height":0,"passthru":true,"multiple":false,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"topic","topicType":"msg","x":910,"y":1120,"wires":[["94fa3166.8a55c"]]},{"id":"e3810c43.3e236","type":"delay","z":"236861.38a5b7a","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1340,"y":1040,"wires":[["89738db8.c4179"]]},{"id":"89738db8.c4179","type":"function","z":"236861.38a5b7a","name":"","func":"flow.set =(\"recevoirSignal\",1)\nmsg.payload = \"M20\\n\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1500,"y":1040,"wires":[["111554ab.20ee6b"]]},{"id":"34592559.b9a7ea","type":"switch","z":"236861.38a5b7a","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":".GCO","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":170,"y":1120,"wires":[["f6fc16db.338368","65267da.3d97d84"]]},{"id":"94fa3166.8a55c","type":"function","z":"236861.38a5b7a","name":"fichierChoisi","func":"flow.set =(\"fichierChoisi\",msg.payload);","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1330,"y":1120,"wires":[[]]},{"id":"65267da.3d97d84","type":"debug","z":"236861.38a5b7a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":510,"y":1040,"wires":[]},{"id":"f6fc16db.338368","type":"function","z":"236861.38a5b7a","name":"append list ","func":"fichiers=[];\nfichiers = flow.get(\"fichiers\");\nmsg.options.push(msg.payload);\nmsg.options = fichiers;\nflow.set(\"fichiers\",fichiers);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":470,"y":1120,"wires":[["74c5d1a5.8fb54"]]},{"id":"f4ccbc70.4d08b","type":"function","z":"236861.38a5b7a","name":"raz de list","func":"flow.set=(\"fichiers\",[\"Select Option\"]);\n msg.options = [\"derfghj\"];\n return msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1180,"y":1080,"wires":[["74c5d1a5.8fb54"]]},{"id":"d47dab87.de9298","type":"serial-port","serialport":"COM7","serialbaud":"115200","databits":"8","parity":"none","stopbits":"1","waitfor":"","dtr":"none","rts":"none","cts":"none","dsr":"none","newline":"\\n","bin":"false","out":"char","addchar":"","responsetimeout":"10000"},{"id":"fbe44ce1.d7606","type":"ui_group","name":"Impression","tab":"871a5df8.1826a","order":2,"disp":true,"width":"8","collapse":false},{"id":"871a5df8.1826a","type":"ui_tab","name":"Controle","icon":"fa-cog","disabled":false,"hidden":false}]
and for the the data input fo this node is the folowing photo


ffor the content of the function who is generate the problem' fichiers = flow.get("fichiers");
msg.options.push(msg.payload);
msg.options = fichiers;
flow.set("fichiers",fichiers);
return msg;'

what are you trying to achieve?




PS, in future, please also copy value and paste value as text (not screenshot - save us writing it out) - Use the Copy Value button...
BX00Cy7yHi

05/10/2021, 01:00:48node: 65267da.3d97d84msg : Object

object

payload: string

CE3PRO~2.GCO 4042484

port: "COM7"

_msgid: "8e21e7f6.897408"

I will try to rectify the problem in the picture you mentioned

for msg .option i was declared and initialized in ras function this is the following lines write in the raz nodeflow.set=("fichiers",["Select Option"]); msg.options = ["test"]; return msg;

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.