# SNMP-set node issue

**URL:** <https://discourse.nodered.org/t/snmp-set-node-issue/16028>\
**Category:** General\
**Created:** [28 September 2019 15:55 UTC](https://discourse.nodered.org/t/snmp-set-node-issue/16028 "2019-09-28T15:55:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kresten88](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kresten88/32/13197_2.png) [@kresten88](https://discourse.nodered.org/u/kresten88)\
**Post date:** [28 September 2019 15:55 UTC](https://discourse.nodered.org/t/snmp-set-node-issue/16028/1 "2019-09-28T15:55:41Z")

</div>

For some reason, which I cannot find, an SNMP set from a simple dropdown list works perfect.  
The same does not work when I use a dropdown list with data from a DBquery.

Here is the working debug msg after my function (before it goed to my snmpset node)  
 ![Captureworks](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/3/3b35c19d96960340319c5a42ce53b0288ab81d87.png)

And then this one does not work and gives me:  
"RequestFailedError: NoSuchName: 1.3.6.1.4.1.5835.3.1.3.1.38.1.1"  
 ![Captureworksnot](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/a/a41b743aa76375d6c1cfc0db559875f24db7f3d5.png)

What am I missing here ?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [28 September 2019 16:19 UTC](https://discourse.nodered.org/t/snmp-set-node-issue/16028/2 "2019-09-28T16:19:41Z")

</div>

really odd - at that level it looks the same. The only properties it makes use of are msg.host, msg.community and msg.varbinds, of which you are only using varbinds. The payload is a string in one and numeric in the other... but... that shouldn't be relevant.

---

<div class="post-metadata">

**Author:** ![kresten88](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kresten88/32/13197_2.png) [@kresten88](https://discourse.nodered.org/u/kresten88)\
**Post date:** [29 September 2019 06:30 UTC](https://discourse.nodered.org/t/snmp-set-node-issue/16028/3 "2019-09-29T06:30:19Z")

</div>

Indeed odd.

I can`t see why it throws the error: "TypeError: Cannot read property 'FreqUp' of undefined"  
from my function:

```auto
msg.payload = msg.payload[0]['FreqUp']*100000;
msg.varbinds = [
    {
        "host": "192.168.0.34",
        "version": "1",
        "oid": "1.3.6.1.4.1.5835.3.1.3.1.38.1.1",
        "type": "OctetString",
         "value": ""+msg.payload+""
    }
]
return msg;

```

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [29 September 2019 07:43 UTC](https://discourse.nodered.org/t/snmp-set-node-issue/16028/4 "2019-09-29T07:43:17Z")

</div>

Sorry. Confused now. Where is this function. Can you share this part of your flow including SNMP node?

---

<div class="post-metadata">

**Author:** ![kresten88](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kresten88/32/13197_2.png) [@kresten88](https://discourse.nodered.org/u/kresten88)\
**Post date:** [29 September 2019 07:45 UTC](https://discourse.nodered.org/t/snmp-set-node-issue/16028/5 "2019-09-29T07:45:40Z")

</div>

Here is the flow

```auto
[{"id":"a134927a.6ac65","type":"mysql","z":"3b93f73c.7a4e48","mydb":"98dc2b32.560778","name":"","x":460,"y":180,"wires":[["f5802c0d.191d1"]]},{"id":"81e5bd0.5c3dd4","type":"function","z":"3b93f73c.7a4e48","name":"","func":"msg.topic = \"SELECT `channel` FROM `NodeRed`.`7bchannels`\"\nreturn msg;","outputs":1,"noerr":0,"x":310,"y":180,"wires":[["a134927a.6ac65"]]},{"id":"a7e3d4fe.e49f28","type":"change","z":"3b93f73c.7a4e48","name":"change","rules":[{"t":"set","p":"options","pt":"msg","to":"payload","tot":"msg"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":800,"y":180,"wires":[["fa5ef97f.fc4558"]]},{"id":"f5802c0d.191d1","type":"function","z":"3b93f73c.7a4e48","name":"format array ","func":"//Reformat array to work with dashboard\nvar reformattedArray = msg.payload.map(obj =>{\n //declare the reformatted object\n var rObj = {};\n //format it for drop down\n //\"label\":\"value\" is the format so lets move the value to the label and add some txt as well\n //you can also replce the txt with a var if you want\n rObj[obj.channel] = obj.channel;\n return rObj;\n});\nmsg.payload = reformattedArray;\nreturn msg;\n","outputs":1,"noerr":0,"x":630,"y":180,"wires":[["a7e3d4fe.e49f28"]]},{"id":"fa5ef97f.fc4558","type":"ui_dropdown","z":"3b93f73c.7a4e48","name":"","label":"","tooltip":"","place":"Channel","group":"a782ff3f.bf5bb","order":1,"width":0,"height":0,"passthru":true,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"","x":960,"y":180,"wires":[["b023d576.879cd8"]]},{"id":"13d6c3db.32f9dc","type":"ui_ui_control","z":"3b93f73c.7a4e48","name":"","events":"change","x":140,"y":180,"wires":[["81e5bd0.5c3dd4"]]},{"id":"b023d576.879cd8","type":"function","z":"3b93f73c.7a4e48","name":"","func":"t = \"SELECT * FROM NodeRed.7bchannels WHERE channel='\"+msg.payload+\"'\"\nreturn {topic:t}\nreturn msg;\n","outputs":1,"noerr":0,"x":310,"y":260,"wires":[["6218f8bd.cec9c8"]]},{"id":"6218f8bd.cec9c8","type":"mysql","z":"3b93f73c.7a4e48","mydb":"98dc2b32.560778","name":"","x":480,"y":260,"wires":[["3ff2eeef.95e992","ce63abad.10a078"]]},{"id":"3ff2eeef.95e992","type":"ui_table","z":"3b93f73c.7a4e48","group":"be00751c.52f3c8","name":"","order":1,"width":0,"height":0,"columns":[{"field":"Channel","title":"Channel","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"FreqUp","title":"Uplink","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"FreqDown","title":"Downlink","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"Sr","title":"Sr","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"RollOff","title":"Roll","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"Txp","title":"Transponder","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"PolUp","title":"Pol Up","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"PolDown","title":"Pol Down","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}}],"outputs":0,"cts":false,"x":790,"y":260,"wires":[]},{"id":"ce63abad.10a078","type":"function","z":"3b93f73c.7a4e48","name":"","func":"msg.payload = msg.payload[0]['FreqUp']*100000;\nmsg.varbinds = [\n {\n \"host\": \"192.168.0.34\",\n \"version\": \"1\",\n \"oid\": \"1.3.6.1.4.1.5835.3.1.3.1.38.1.1\",\n \"type\": \"OctetString\",\n \"value\": \"\"+msg.payload+\"\"\n }\n]\nreturn msg;","outputs":1,"noerr":0,"x":790,"y":360,"wires":[["7672b4a4.46307c"]]},{"id":"7672b4a4.46307c","type":"snmp set","z":"3b93f73c.7a4e48","host":"192.168.0.34","community":"public","version":"1","varbinds":"","timeout":5,"name":"","x":1020,"y":360,"wires":[]},{"id":"98dc2b32.560778","type":"MySQLdatabase","z":"","host":"127.0.0.1","port":"3306","db":"NodeRed","tz":""},{"id":"a782ff3f.bf5bb","type":"ui_group","z":"","name":"Default","tab":"f0a3f99c.51e178","disp":true,"width":3,"collapse":false},{"id":"be00751c.52f3c8","type":"ui_group","z":"","name":"Details","tab":"f0a3f99c.51e178","order":2,"disp":true,"width":20,"collapse":false},{"id":"f0a3f99c.51e178","type":"ui_tab","z":"","name":"Test","icon":"dashboard","order":6,"disabled":false,"hidden":false}]

```
