The thing I want to do is:
I have 2 dropdown menus. When I select the product in 'dropdown product' I want to select in the 'dropdown type' the product type.
So when I select ball in 'product'. I want to select the type of ball in 'type'.
I used a template node to simulate the following csv file:
This is the flow:
[{"id":"8c0623de.87ca1","type":"inject","z":"b4370c04.a6c7d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":240,"y":2640,"wires":[["3ce8055d.54a18a"]]},{"id":"3ce8055d.54a18a","type":"template","z":"b4370c04.a6c7d","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"product,ball,train,hat\nball,baseball,yellowtrain,bighat\ntrain ,football,bluetrain,smallhat\nhat,tennisball,redtrain,mediumhat","output":"str","x":280,"y":2680,"wires":[["a1092c24.2d9c8"]]},{"id":"a1092c24.2d9c8","type":"csv","z":"b4370c04.a6c7d","name":"","sep":",","hdrin":true,"hdrout":"none","multi":"mult","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":430,"y":2680,"wires":[["710b3dda.63a9b4","36d6405f.fb078","c348b469.19c818"]]},{"id":"710b3dda.63a9b4","type":"change","z":"b4370c04.a6c7d","name":"change1","rules":[{"t":"set","p":"options","pt":"msg","to":"payload.{product: product}","tot":"jsonata"},{"t":"set","p":"test","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":2680,"wires":[["41316f23.24fc1","86da049b.8aed18"]]},{"id":"41316f23.24fc1","type":"ui_dropdown","z":"b4370c04.a6c7d","name":"","label":"product","tooltip":"","place":"Select option","group":"7da9517d.305a1","order":1,"width":0,"height":0,"passthru":false,"multiple":false,"options":[{"label":"test","value":"","type":"str"}],"payload":"","topic":"topic","topicType":"msg","x":820,"y":2680,"wires":[["3fbad61f.c17efa","8835f550.6d4fb"]]},{"id":"3fbad61f.c17efa","type":"debug","z":"b4370c04.a6c7d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":990,"y":2640,"wires":[]},{"id":"36d6405f.fb078","type":"debug","z":"b4370c04.a6c7d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":590,"y":2640,"wires":[]},{"id":"c348b469.19c818","type":"change","z":"b4370c04.a6c7d","name":"change2","rules":[{"t":"set","p":"options","pt":"msg","to":"payload.{$$.test: $$.test}","tot":"jsonata"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":2800,"wires":[["28949ca7.79c294","6def0228.d2382c"]]},{"id":"28949ca7.79c294","type":"ui_dropdown","z":"b4370c04.a6c7d","name":"","label":"type","tooltip":"","place":"Select option","group":"7da9517d.305a1","order":2,"width":0,"height":0,"passthru":false,"multiple":false,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"topic","topicType":"msg","x":990,"y":2800,"wires":[[]]},{"id":"6def0228.d2382c","type":"debug","z":"b4370c04.a6c7d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":970,"y":2760,"wires":[]},{"id":"8835f550.6d4fb","type":"change","z":"b4370c04.a6c7d","name":"","rules":[{"t":"set","p":"test","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1030,"y":2680,"wires":[["a34961c7.b9cb78","c348b469.19c818"]]},{"id":"a34961c7.b9cb78","type":"debug","z":"b4370c04.a6c7d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1210,"y":2680,"wires":[]},{"id":"86da049b.8aed18","type":"debug","z":"b4370c04.a6c7d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":810,"y":2640,"wires":[]},{"id":"7da9517d.305a1","type":"ui_group","name":"","tab":"1ea6ab39.e574b5","order":1,"disp":true,"width":"6","collapse":false},{"id":"1ea6ab39.e574b5","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]
When I fill the following in 'change2' i get a list op ball types:
But I want to use msg.test to fill in the word 'ball'. So the dropdown 'type' becomes dynamic. So if I choose another product, the types of that product can be chosen
I tried with $$.test
to select the string of msg.test but that doesn't work.
I don't understand what I'm doing wrong.