# Inject MySQL datas to slider

**URL:** <https://discourse.nodered.org/t/inject-mysql-datas-to-slider/24390>\
**Category:** Dashboard\
**Created:** [7 April 2020 10:00 UTC](https://discourse.nodered.org/t/inject-mysql-datas-to-slider/24390 "2020-04-07T10:00:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cheun](https://avatars.discourse-cdn.com/v4/letter/c/0ea827/32.png) [@cheun](https://discourse.nodered.org/u/cheun)\
**Post date:** [7 April 2020 10:00 UTC](https://discourse.nodered.org/t/inject-mysql-datas-to-slider/24390/1 "2020-04-07T10:00:00Z")

</div>

Hello,

I'm trying to set a slider position from a MySQL database.  
I tested on a gauge and it works well but despite all my tests the slider remains at 0.  
Can someone explain to me where I made a mistake?  
Thanks for your help!

```auto
[{"id":"948a9bcb.b13a18","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"8fea9051.f5709","type":"inject","z":"948a9bcb.b13a18","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":"1","x":170,"y":320,"wires":[["d8135987.0eabb8"]]},{"id":"d8135987.0eabb8","type":"function","z":"948a9bcb.b13a18","name":"","func":"msg.topic='select lum from current_settings'\nreturn msg;","outputs":1,"noerr":0,"x":350,"y":320,"wires":[["7d357c56.1c0714"]]},{"id":"7d357c56.1c0714","type":"mysql","z":"948a9bcb.b13a18","mydb":"2f1a5af1.aa5b26","name":"db","x":510,"y":320,"wires":[["cd3d4ed0.6935c","37968f98.bd8e4","cc182677.3de1f8"]]},{"id":"cd3d4ed0.6935c","type":"ui_slider","z":"948a9bcb.b13a18","name":"","label":"slider","tooltip":"","group":"f0bbf294.5fdec","order":2,"width":0,"height":0,"passthru":true,"outs":"all","topic":"{{msg.payload[0].lum}}","min":0,"max":"100","step":1,"x":670,"y":320,"wires":[[]]},{"id":"37968f98.bd8e4","type":"debug","z":"948a9bcb.b13a18","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":630,"y":260,"wires":[]},{"id":"cc182677.3de1f8","type":"ui_gauge","z":"948a9bcb.b13a18","name":"","group":"f0bbf294.5fdec","order":1,"width":0,"height":0,"gtype":"gage","title":"gauge","label":"units","format":"{{msg.payload[0].lum}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":680,"y":400,"wires":[]},{"id":"2f1a5af1.aa5b26","type":"MySQLdatabase","z":"","host":"127.0.0.1","port":"3306","db":"nodered","tz":""},{"id":"f0bbf294.5fdec","type":"ui_group","z":"","name":"Default","tab":"d17418dd.ed6648","disp":true,"width":"6","collapse":false},{"id":"d17418dd.ed6648","type":"ui_tab","z":"","name":"Menu","icon":"fa-tachometer","order":5,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [7 April 2020 11:26 UTC](https://discourse.nodered.org/t/inject-mysql-datas-to-slider/24390/2 "2020-04-07T11:26:49Z")

</div>

The slider expects the input to be a numeric value in msg.payload - you need to use a change node to move the `msg.payload[0].lum` to msg.payload.

---

<div class="post-metadata">

**Author:** ![cheun](https://avatars.discourse-cdn.com/v4/letter/c/0ea827/32.png) [@cheun](https://discourse.nodered.org/u/cheun)\
**Post date:** [7 April 2020 12:41 UTC](https://discourse.nodered.org/t/inject-mysql-datas-to-slider/24390/3 "2020-04-07T12:41:00Z")

</div>

Thank you dceejay, that was the trick !

---

<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:** [21 April 2020 12:41 UTC](https://discourse.nodered.org/t/inject-mysql-datas-to-slider/24390/4 "2020-04-21T12:41:04Z")

</div>

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