# Payload concatenate from slider input

**URL:** <https://discourse.nodered.org/t/payload-concatenate-from-slider-input/57281>\
**Category:** General\
**Created:** [26 January 2022 18:13 UTC](https://discourse.nodered.org/t/payload-concatenate-from-slider-input/57281 "2022-01-26T18:13:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![SoxxZ](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/soxxz/32/55042_2.png) [@SoxxZ](https://discourse.nodered.org/u/SoxxZ)\
**Post date:** [26 January 2022 18:13 UTC](https://discourse.nodered.org/t/payload-concatenate-from-slider-input/57281/1 "2022-01-26T18:13:50Z")

</div>

i have 3 sliders on the node red dashboard. one for brightness, one for saturation, and one for speed, of a rgb strip animation(done outside node red). i want to get these 3 values, and concatenate them into one payload with this format :"/speed,brightness,saturation", with the press of a button to send it.  
How could i do it? I've tried the join node, but wasn't able to make it send only when the button is pressed, and couldn't figure out how to set the topics as the order matters.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [26 January 2022 18:22 UTC](https://discourse.nodered.org/t/payload-concatenate-from-slider-input/57281/2 "2022-01-26T18:22:40Z")

</div>

You could save each slider output in a context variable eg flow.saturation.  
When the button is pressed use a function node to retrieve the values and format your string.  
You will have to make sure each variable has a value before sending the payload to the other application.

---

<div class="post-metadata">

**Author:** ![mickym2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mickym2/32/36128_2.png) [@mickym2](https://discourse.nodered.org/u/mickym2)\
**Post date:** [26 January 2022 19:33 UTC](https://discourse.nodered.org/t/payload-concatenate-from-slider-input/57281/3 "2022-01-26T19:33:21Z")

</div>

Use a flow variable as object and change the properties with slider. Then use a change node and send the updated flow varible.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/4/442453ed6d0566af7fdc6f868d11a49654cac3ea.png)

```auto
[{"id":"d8c7542fd1ba1637","type":"ui_slider","z":"3ab40be9bd525d05","name":"speed","label":"Speed","tooltip":"","group":"113ae86234f6470e","order":0,"width":0,"height":0,"passthru":true,"outs":"all","topic":"topic","topicType":"msg","min":0,"max":"100","step":1,"className":"","x":520,"y":200,"wires":[["1a518560eae779e7"]]},{"id":"9e7721d7ca7046e0","type":"ui_slider","z":"3ab40be9bd525d05","name":"brightness","label":"Brightness","tooltip":"","group":"113ae86234f6470e","order":0,"width":0,"height":0,"passthru":true,"outs":"all","topic":"topic","topicType":"msg","min":0,"max":"100","step":1,"className":"","x":510,"y":260,"wires":[["acd0c8c15e532c29"]]},{"id":"8355edf466bb525d","type":"ui_slider","z":"3ab40be9bd525d05","name":"saturation","label":"Saturation","tooltip":"","group":"113ae86234f6470e","order":0,"width":0,"height":0,"passthru":true,"outs":"all","topic":"topic","topicType":"msg","min":0,"max":"100","step":1,"className":"","x":520,"y":320,"wires":[["16758cc073c2affc"]]},{"id":"1a518560eae779e7","type":"change","z":"3ab40be9bd525d05","name":"","rules":[{"t":"set","p":"rgb.speed","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":200,"wires":[["f122103796bad4f7"]]},{"id":"acd0c8c15e532c29","type":"change","z":"3ab40be9bd525d05","name":"","rules":[{"t":"set","p":"rgb.brightness","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":260,"wires":[["f122103796bad4f7"]]},{"id":"16758cc073c2affc","type":"change","z":"3ab40be9bd525d05","name":"","rules":[{"t":"set","p":"rgb.saturation","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":320,"wires":[["f122103796bad4f7"]]},{"id":"f122103796bad4f7","type":"change","z":"3ab40be9bd525d05","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"rgb","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":1000,"y":260,"wires":[["44425e3e6162e389"]]},{"id":"44425e3e6162e389","type":"debug","z":"3ab40be9bd525d05","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1210,"y":260,"wires":[]},{"id":"113ae86234f6470e","type":"ui_group","name":"Standard","tab":"dc25fe35.866f","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"dc25fe35.866f","type":"ui_tab","name":"Test","icon":"dashboard","order":17,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![SoxxZ](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/soxxz/32/55042_2.png) [@SoxxZ](https://discourse.nodered.org/u/SoxxZ)\
**Post date:** [26 January 2022 19:48 UTC](https://discourse.nodered.org/t/payload-concatenate-from-slider-input/57281/4 "2022-01-26T19:48:32Z")

</div>

didn't know about this context variables. thank you so much!

---

<div class="post-metadata">

**Author:** ![mickym2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mickym2/32/36128_2.png) [@mickym2](https://discourse.nodered.org/u/mickym2)\
**Post date:** [26 January 2022 20:06 UTC](https://discourse.nodered.org/t/payload-concatenate-from-slider-input/57281/5 "2022-01-26T20:06:45Z")

</div>

To initialize the flow variable - just use an inject node to set the object.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/2/b25ce7fb6d3c913ec7447c36e4325587e123dbbc.png)

It seems however that the slider node doesn't pass through the payload - so you have to set the flow variable in addition.

```auto
[{"id":"a0f0f1786925ec5c","type":"ui_slider","z":"4d10480e58e652d4","name":"speed","label":"Speed","tooltip":"","group":"113ae86234f6470e","order":0,"width":0,"height":0,"passthru":true,"outs":"all","topic":"topic","topicType":"msg","min":0,"max":"100","step":1,"className":"","x":490,"y":200,"wires":[["a8937c5d4ba2beaa"]]},{"id":"26467b7c4dd57b7a","type":"ui_slider","z":"4d10480e58e652d4","name":"brightness","label":"Brightness","tooltip":"","group":"113ae86234f6470e","order":0,"width":0,"height":0,"passthru":true,"outs":"all","topic":"topic","topicType":"msg","min":0,"max":"100","step":1,"className":"","x":480,"y":260,"wires":[["1748622aa205d519"]]},{"id":"7a2064a0d55a5e4d","type":"ui_slider","z":"4d10480e58e652d4","name":"saturation","label":"Saturation","tooltip":"","group":"113ae86234f6470e","order":0,"width":0,"height":0,"passthru":true,"outs":"all","topic":"topic","topicType":"msg","min":0,"max":"100","step":1,"className":"","x":490,"y":320,"wires":[["6ab334a1fe02b0d3"]]},{"id":"a8937c5d4ba2beaa","type":"change","z":"4d10480e58e652d4","name":"","rules":[{"t":"set","p":"rgb.speed","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":200,"wires":[["cb370b9794771705"]]},{"id":"1748622aa205d519","type":"change","z":"4d10480e58e652d4","name":"","rules":[{"t":"set","p":"rgb.brightness","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":260,"wires":[["cb370b9794771705"]]},{"id":"6ab334a1fe02b0d3","type":"change","z":"4d10480e58e652d4","name":"","rules":[{"t":"set","p":"rgb.saturation","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":320,"wires":[["cb370b9794771705"]]},{"id":"cb370b9794771705","type":"change","z":"4d10480e58e652d4","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"rgb","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":970,"y":260,"wires":[["9d67797187b8bdef"]]},{"id":"9d67797187b8bdef","type":"debug","z":"4d10480e58e652d4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1180,"y":260,"wires":[]},{"id":"5d819752697b08ec","type":"inject","z":"4d10480e58e652d4","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"{\"speed\":70,\"brightness\":70,\"saturation\":70}","payloadType":"json","x":110,"y":120,"wires":[["e66d80bdb76e3603","2903e170e86b181a","27f8ab4303c7d41b","aed978975523a71e"]]},{"id":"e66d80bdb76e3603","type":"change","z":"4d10480e58e652d4","name":"","rules":[{"t":"set","p":"rgb","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":120,"wires":[[]]},{"id":"2903e170e86b181a","type":"change","z":"4d10480e58e652d4","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.speed","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":290,"y":200,"wires":[["a0f0f1786925ec5c"]]},{"id":"27f8ab4303c7d41b","type":"change","z":"4d10480e58e652d4","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.brightness","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":290,"y":260,"wires":[["26467b7c4dd57b7a"]]},{"id":"aed978975523a71e","type":"change","z":"4d10480e58e652d4","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.saturation","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":290,"y":320,"wires":[["7a2064a0d55a5e4d"]]},{"id":"113ae86234f6470e","type":"ui_group","name":"Standard","tab":"dc25fe35.866f","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"dc25fe35.866f","type":"ui_tab","name":"Test","icon":"dashboard","order":17,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [27 March 2022 20:07 UTC](https://discourse.nodered.org/t/payload-concatenate-from-slider-input/57281/6 "2022-03-27T20:07:17Z")

</div>

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