Dashboard dropdown list miss-selection

Hello everybody. I'm quite new to node-red and I'm slowly figuring out some things, until eventually stumbled on the following issue and I'm not sure if it is a bug or not since the data I'm passing seems correct in the flow.

I have button that queries a psql node which fetches data from a table in the following format: id, address, temperature. Then I have a function node that will format the provided payload and put it into msg.options key:value pairs format where key is "address" and value is the temperature value, which are then sent to a dropdown list connected to a gauge node. Everything works perfect. When I click refresh the dropdown list gets populated and when I select address from the list the gauge displays the respective value. The problem is if I have addresses which share the same temperature values, the moment I try to select the closest address to the top of the dropdown list(for ex.: G.Kochev - temp 36), it selects instead the last address from the dropdown list that has temperature value the same as the value I wanted to select(for ex.: Jivkovo - temp 36).


In this example I have selected "bul. Jitnica" and as you see the dropdown selection is the last dropdown entry with the value of "bul. Jitnica", which is "Dlna Marina".

Any ideas for where the problem might be coming from would be greatly appreciated.

This is happening as the dropdown uses the value field to match the selected item, and settles on the last match. You can work round it by passing the complete obj or parts in the value, this makes all values individual.
e.g.

[{"id":"96f1a94b4b96c69d","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"id\":1,\"address\":\"12\",\"temperature\":13},{\"id\":2,\"address\":\"22\",\"temperature\":14},{\"id\":3,\"address\":\"32\",\"temperature\":13}]","payloadType":"json","x":130,"y":7700,"wires":[["e387dc7eae5215ce"]]},{"id":"e387dc7eae5215ce","type":"change","z":"d1395164b4eec73e","name":"","rules":[{"t":"set","p":"options","pt":"msg","to":"$$.payload.{$.address:$}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":100,"y":7740,"wires":[["67f5c46675bd2a36"]]},{"id":"67f5c46675bd2a36","type":"ui_dropdown","z":"d1395164b4eec73e","name":"","label":"","tooltip":"","place":"Select option","group":"8b5cde76.edd58","order":9,"width":0,"height":0,"passthru":false,"multiple":false,"options":[],"payload":"","topic":"topic","topicType":"msg","className":"","x":300,"y":7740,"wires":[["18faee8ccb25a78c","2488e334798e44ea"]]},{"id":"18faee8ccb25a78c","type":"debug","z":"d1395164b4eec73e","name":"debug 2489","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":470,"y":7740,"wires":[]},{"id":"2488e334798e44ea","type":"ui_gauge","z":"d1395164b4eec73e","name":"","group":"8b5cde76.edd58","order":10,"width":0,"height":0,"gtype":"gage","title":"{{msg.payload.address}}","label":"units","format":"{{msg.payload.temperature}}","min":0,"max":10,"colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","diff":false,"className":"","x":330,"y":7800,"wires":[]},{"id":"8b5cde76.edd58","type":"ui_group","name":"default","tab":"8f03e639.85956","order":1,"disp":false,"width":"12","collapse":false},{"id":"8f03e639.85956","type":"ui_tab","name":"Home","icon":"dashboard","order":3,"disabled":false,"hidden":false}]

Not only that you helped me, but I learned a few things with your example. Thank you very much!

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