Select type first, then product from CSV file

Hi Everybody,

Last time I asked about select on product and type from a CSV file. And it works great!
Thanks again for helping me! :smiley:

In the mean time I have created a huge product list and I want to sort on "type" first. So there are less products in the dropdown menu. So finding the right product is easier.

The first flow is a dropdown for selecting the product. The output is the type, product, and takt value. This flow works fine :slight_smile:

The second flow has 2 dropdown menus. One for the type, and one for the product belongs to the selected type.
Works also fine in the dropdown menu. But the problem is: I want that the second flow also has the output: type, product, and takt value.

Is there a simple way to do this?
I think it is but I don't see it.

This is the flow:

[{"id":"c4bf66.1cb1f098","type":"inject","z":"746b7c20.6ac00c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":340,"y":220,"wires":[["4387474c.b83518","76966f79.8617c"]]},{"id":"4387474c.b83518","type":"template","z":"746b7c20.6ac00c","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"type;A;B;C;type2;product;takt\nA;apples1;bananas1;cherry's1;A;apples1;60\nB;apples2;bananas2;cherry's2;A;apples2;61\nC;apples3;bananas3;cherry's3;A;apples3;62\n;apples4;bananas4;cherry's4;A;apples4;63\n;apples5;bananas5;cherry's5;A;apples5;64\n;apples6;bananas6;cherry's6;A;apples6;65\n;apples7;bananas7;cherry's7;A;apples7;66\n;apples8;bananas8;cherry's8;A;apples8;67\n;;;cherry's9;B;bananas1;70\n;;;cherry's10;B;bananas2;71\n;;;cherry's11;B;bananas3;72\n;;;cherry's12;B;bananas4;73\n;;;;B;bananas5;74\n;;;;B;bananas6;75\n;;;;B;bananas7;76\n;;;;B;bananas8;77\n;;;;C;cherry's1;90\n;;;;C;cherry's2;91\n;;;;C;cherry's3;92\n;;;;C;cherry's4;93\n;;;;C;cherry's5;94\n;;;;C;cherry's6;95\n;;;;C;cherry's7;96\n;;;;C;cherry's8;97\n;;;;C;cherry's9;98\n;;;;C;cherry's10;99\n;;;;C;cherry's11;100\n;;;;C;cherry's12;101","output":"str","x":540,"y":220,"wires":[[]]},{"id":"ea6d82b9.900608","type":"csv","z":"746b7c20.6ac00c","name":"","sep":";","hdrin":true,"hdrout":"none","multi":"mult","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":690,"y":220,"wires":[["6cf510bb.a9b408"]]},{"id":"6cf510bb.a9b408","type":"change","z":"746b7c20.6ac00c","name":"","rules":[{"t":"set","p":"options","pt":"msg","to":"payload.{product: $}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":220,"wires":[["791af232.1e9dcc"]]},{"id":"791af232.1e9dcc","type":"ui_dropdown","z":"746b7c20.6ac00c","name":"","label":"Product","tooltip":"","place":"Select type","group":"a01cca30.f7142","order":1,"width":0,"height":0,"passthru":false,"multiple":false,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"topic","x":1040,"y":220,"wires":[["224de115.06a916"]]},{"id":"224de115.06a916","type":"debug","z":"746b7c20.6ac00c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1170,"y":220,"wires":[]},{"id":"34d0b7a2.bb0f9","type":"inject","z":"746b7c20.6ac00c","name":"","props":[{"p":"payload"},{"p":"test","v":"product","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":340,"y":380,"wires":[["ecd5872e.942"]]},{"id":"3f6764e3.d5eeac","type":"csv","z":"746b7c20.6ac00c","name":"","sep":";","hdrin":true,"hdrout":"none","multi":"mult","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":670,"y":460,"wires":[["54b4d109.0122d8","84d416ec.cc46d8"]]},{"id":"54b4d109.0122d8","type":"change","z":"746b7c20.6ac00c","name":"","rules":[{"t":"set","p":"options","pt":"msg","to":"$lookup(payload,\"type\")","tot":"jsonata"},{"t":"move","p":"payload","pt":"msg","to":"hold","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":460,"wires":[["b3a92249.f32158"]]},{"id":"84d416ec.cc46d8","type":"debug","z":"746b7c20.6ac00c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":770,"y":400,"wires":[]},{"id":"b3a92249.f32158","type":"ui_dropdown","z":"746b7c20.6ac00c","name":"","label":"type","tooltip":"","place":"Select option","group":"a01cca30.f7142","order":3,"width":0,"height":0,"passthru":false,"multiple":false,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"topic","x":1050,"y":460,"wires":[["a26a6a82.71ed68","130b67a4.da1438"]]},{"id":"a26a6a82.71ed68","type":"debug","z":"746b7c20.6ac00c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1210,"y":400,"wires":[]},{"id":"130b67a4.da1438","type":"change","z":"746b7c20.6ac00c","name":"","rules":[{"t":"set","p":"options","pt":"msg","to":"$lookup($flowContext(\"hold\"),payload)","tot":"jsonata"},{"t":"move","p":"payload","pt":"msg","to":"hold2","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":1260,"y":460,"wires":[["afa50150.ee5278"]]},{"id":"afa50150.ee5278","type":"ui_dropdown","z":"746b7c20.6ac00c","name":"","label":"product","tooltip":"","place":"Select option","group":"a01cca30.f7142","order":4,"width":0,"height":0,"passthru":false,"multiple":false,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"topic","x":1470,"y":460,"wires":[["2be159b4.727906"]]},{"id":"2be159b4.727906","type":"debug","z":"746b7c20.6ac00c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1610,"y":460,"wires":[]},{"id":"76966f79.8617c","type":"template","z":"746b7c20.6ac00c","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"type;product;takt\nA;apples1;60\nA;apples2;61\nA;apples3;62\nA;apples4;63\nA;apples5;64\nA;apples6;65\nA;apples7;66\nA;apples8;67\nB;bananas1;70\nB;bananas2;71\nB;bananas3;72\nB;bananas4;73\nB;bananas5;74\nB;bananas6;75\nB;bananas7;76\nB;bananas8;77\nC;cherry's1;90\nC;cherry's2;91\nC;cherry's3;92\nC;cherry's4;93\nC;cherry's5;94\nC;cherry's6;95\nC;cherry's7;96\nC;cherry's8;97\nC;cherry's9;98\nC;cherry's10;99\nC;cherry's11;100\nC;cherry's12;101","output":"str","x":540,"y":280,"wires":[["ea6d82b9.900608"]]},{"id":"ecd5872e.942","type":"template","z":"746b7c20.6ac00c","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"type;A;B;C;type2;product;takt\nA;apples1;bananas1;cherry's1;A;apples1;60\nB;apples2;bananas2;cherry's2;A;apples2;61\nC;apples3;bananas3;cherry's3;A;apples3;62\n;apples4;bananas4;cherry's4;A;apples4;63\n;apples5;bananas5;cherry's5;A;apples5;64\n;apples6;bananas6;cherry's6;A;apples6;65\n;apples7;bananas7;cherry's7;A;apples7;66\n;apples8;bananas8;cherry's8;A;apples8;67\n;;;cherry's9;B;bananas1;70\n;;;cherry's10;B;bananas2;71\n;;;cherry's11;B;bananas3;72\n;;;cherry's12;B;bananas4;73\n;;;;B;bananas5;74\n;;;;B;bananas6;75\n;;;;B;bananas7;76\n;;;;B;bananas8;77\n;;;;C;cherry's1;90\n;;;;C;cherry's2;91\n;;;;C;cherry's3;92\n;;;;C;cherry's4;93\n;;;;C;cherry's5;94\n;;;;C;cherry's6;95\n;;;;C;cherry's7;96\n;;;;C;cherry's8;97\n;;;;C;cherry's9;98\n;;;;C;cherry's10;99\n;;;;C;cherry's11;100\n;;;;C;cherry's12;101","output":"str","x":520,"y":420,"wires":[["3f6764e3.d5eeac"]]},{"id":"a01cca30.f7142","type":"ui_group","name":"","tab":"4da6c120.9c3648","order":1,"disp":true,"width":"6","collapse":false},{"id":"4da6c120.9c3648","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

I tried a lot but didn't find the right solution yet.
I tried it with the following table (in csv format). First select the type, and second select the product.
But it doesn't does what I want.
image

I also tried it with 2 csv files. One for selecting the type, and than I tried to use the msg.payload value to select the product from the other csv file. But I had no succes...

Can anyone help me?

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