Dropdown problem

I have a big list of products and properties.

I can handle this make those manually, but I cant figure how to get dropdown selections out from list.
In my flow first output, if I select" kana " is

{"koipi":{"ominaisuuslämpökerroin":3490},"reisi":{"ominaisuuslämpökerroin":3110}}

and I want to get some way also selection "kana"

and if select second dropdown "koipi" output is

{"ominaisuuslämpökerroin":3490}

and I need get some way also "koipi"
How to do this?

Is it possible to align label text right and chage label width or do those for option selection column?

flows (3).json (4.6 KB)

if i understand correctly, try something like this

[{"id":"4ddf868bd9d21d90","type":"inject","z":"8ea55c167a913819","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":120,"wires":[["e06a8980efbb17bc"]]},{"id":"e06a8980efbb17bc","type":"function","z":"8ea55c167a913819","name":"","func":"\n\nmsg.options = Object.keys(flow.get(\"options\"))\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":170,"y":180,"wires":[["dcedea8ae549c0cb"]]},{"id":"dcedea8ae549c0cb","type":"ui_dropdown","z":"8ea55c167a913819","name":"","label":"Raaka-aine:","tooltip":"Valitse valmistettavan tuotteen raaka-aine","place":"Valitse raaka-aine","group":"bd79a5170f624efc","order":5,"width":0,"height":0,"passthru":false,"multiple":false,"options":[],"payload":"","topic":"choice1","topicType":"str","className":"","x":360,"y":180,"wires":[["a1bdb833578d6cd6","341d73ec.e9f044"]]},{"id":"a1bdb833578d6cd6","type":"function","z":"8ea55c167a913819","name":"","func":"msg.options = Object.keys(flow.get(\"options.\" + msg.payload) || {\"error\":\"error\"})\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":630,"y":180,"wires":[["39797fd82a569c02","bb413ddd8902e671"]]},{"id":"341d73ec.e9f044","type":"join","z":"8ea55c167a913819","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":680,"y":240,"wires":[["9cc59614.fd58"]]},{"id":"39797fd82a569c02","type":"ui_dropdown","z":"8ea55c167a913819","name":"Tuote:","label":"Tuote:          ","tooltip":"Valitse valmistettava tuote","place":"Valitse tuote","group":"bd79a5170f624efc","order":7,"width":0,"height":0,"passthru":false,"multiple":false,"options":[],"payload":"","topic":"choice2","topicType":"str","className":"","x":800,"y":180,"wires":[["bb413ddd8902e671","341d73ec.e9f044"]]},{"id":"bb413ddd8902e671","type":"debug","z":"8ea55c167a913819","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":980,"y":160,"wires":[]},{"id":"9cc59614.fd58","type":"function","z":"8ea55c167a913819","name":"","func":"msg.choices = Object.values(msg.payload);\nmsg.payload = flow.get(\"options.\" + msg.choices.join(\".\")) || \"error\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":850,"y":240,"wires":[["117bce76cb694431"]]},{"id":"117bce76cb694431","type":"debug","z":"8ea55c167a913819","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":880,"y":280,"wires":[]},{"id":"35874dd.1ba0db2","type":"inject","z":"8ea55c167a913819","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":80,"wires":[["49e09da4.8da2fc"]]},{"id":"49e09da4.8da2fc","type":"change","z":"8ea55c167a913819","name":"","rules":[{"t":"set","p":"options","pt":"flow","to":"{\"kana\":{\"koipi\":{\"ominaisuuslämpökerroin\":3490},\"reisi\":{\"ominaisuuslämpökerroin\":3110}},\"nauta\":{\"brisket\":{\"ominaisuuslämpökerroin\":3190},\"paisti\":{\"ominaisuuslämpökerroin\":3390}}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":80,"wires":[[]]},{"id":"bd79a5170f624efc","type":"ui_group","name":"Tuotteen1 tiedot","tab":"9e4c8e2faf1237cf","order":1,"disp":true,"width":6,"collapse":false,"className":""},{"id":"9e4c8e2faf1237cf","type":"ui_tab","name":"Aloitus","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

this stores the original object, then uses the keys to create options, and at end keys are used to select the output. This way you can keep the selection and get the output.

Thanks
Almost work well...
If I select from second dropdown "koipi" I get everything I need, but if I then select "reisi" I cant get "ominaisuuslämpökerroin"
How to fix this?

try

[{"id":"48a8c089.2b66c8","type":"inject","z":"bf9e1e33.030598","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":110,"y":1340,"wires":[["9ff3864f.bcc7c8"]]},{"id":"9ff3864f.bcc7c8","type":"function","z":"bf9e1e33.030598","name":"","func":"\n\nmsg.options = Object.keys(flow.get(\"options\"))\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":130,"y":1400,"wires":[["12d9b644.b28a32"]]},{"id":"12d9b644.b28a32","type":"ui_dropdown","z":"bf9e1e33.030598","name":"","label":"Raaka-aine:","tooltip":"Valitse valmistettavan tuotteen raaka-aine","place":"Valitse raaka-aine","group":"be67f9b3.51a828","order":5,"width":0,"height":0,"passthru":false,"multiple":false,"options":[],"payload":"","topic":"choice1","topicType":"str","className":"","x":320,"y":1400,"wires":[["9ca8f72b.2670d8","a68ff12d.cac3b"]]},{"id":"9ca8f72b.2670d8","type":"function","z":"bf9e1e33.030598","name":"","func":"msg.options = Object.keys(flow.get(\"options.\" + msg.payload) || {\"error\":\"error\"})\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":590,"y":1400,"wires":[["9529da1e.63fa28","8700dc67.e7925"]]},{"id":"a68ff12d.cac3b","type":"join","z":"bf9e1e33.030598","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":610,"y":1500,"wires":[["417541.d0f2f2c","8226d599.17ea58"]]},{"id":"9529da1e.63fa28","type":"ui_dropdown","z":"bf9e1e33.030598","name":"Tuote:","label":"Tuote:          ","tooltip":"Valitse valmistettava tuote","place":"Valitse tuote","group":"be67f9b3.51a828","order":7,"width":0,"height":0,"passthru":false,"multiple":false,"options":[],"payload":"","topic":"choice2","topicType":"str","className":"","x":760,"y":1400,"wires":[["8700dc67.e7925","a68ff12d.cac3b"]]},{"id":"8700dc67.e7925","type":"debug","z":"bf9e1e33.030598","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":930,"y":1340,"wires":[]},{"id":"8226d599.17ea58","type":"change","z":"bf9e1e33.030598","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.choice1","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"choice1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":1500,"wires":[["a68ff12d.cac3b"]]},{"id":"417541.d0f2f2c","type":"function","z":"bf9e1e33.030598","name":"","func":"msg.choices = Object.values(msg.payload);\nmsg.payload = flow.get(\"options.\" + msg.choices.join(\".\")) || \"error\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":750,"y":1500,"wires":[["425d9f8e.e700d"]]},{"id":"425d9f8e.e700d","type":"debug","z":"bf9e1e33.030598","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":830,"y":1580,"wires":[]},{"id":"2169f539.7a138a","type":"inject","z":"bf9e1e33.030598","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":110,"y":1300,"wires":[["286e0e35.c60c72"]]},{"id":"286e0e35.c60c72","type":"change","z":"bf9e1e33.030598","name":"","rules":[{"t":"set","p":"options","pt":"flow","to":"{\"kana\":{\"koipi\":{\"ominaisuuslämpökerroin\":3490},\"reisi\":{\"ominaisuuslämpökerroin\":3110}},\"nauta\":{\"brisket\":{\"ominaisuuslämpökerroin\":3190},\"paisti\":{\"ominaisuuslämpökerroin\":3390}}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":1300,"wires":[[]]},{"id":"be67f9b3.51a828","type":"ui_group","name":"Tuotteen1 tiedot","tab":"9e4c8e2faf1237cf","order":1,"disp":true,"width":6,"collapse":false,"className":""},{"id":"9e4c8e2faf1237cf","type":"ui_tab","name":"Aloitus","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

Thanks now it works as i want.

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