Clearing Dashboard textbox prior to update

I have a dashboard textbox that displays a database record count which is working fine, Lets say its displaying a value of 10 and the sql query updates and returns no records I want to either set the textbox to 0 or leave it blank currently it displays the last positive count.

Thank you in advance

Andrew

You would need to send a empty or 0 to the text node prior to updating from the query. If this relates to your previous topic on sending array elements to text nodes, then something like this.

[{"id":"90834dc7f475afa6","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[$round($random()*10),$round($random()*10)]","payloadType":"jsonata","x":430,"y":60,"wires":[["c7ecbcc3aad7a729","c99169a5f6d2f71e"]]},{"id":"c7ecbcc3aad7a729","type":"split","z":"d1395164b4eec73e","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":590,"y":60,"wires":[["f55c284f5c491308"]]},{"id":"c99169a5f6d2f71e","type":"change","z":"d1395164b4eec73e","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":680,"y":20,"wires":[["5ce3538521150066","db935955d2c92528"]]},{"id":"f55c284f5c491308","type":"switch","z":"d1395164b4eec73e","name":"","property":"parts.index","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":710,"y":60,"wires":[["5ce3538521150066"],["db935955d2c92528"]]},{"id":"5ce3538521150066","type":"ui-text","z":"d1395164b4eec73e","group":"9d83cd8b3d5ee33c","order":1,"width":0,"height":0,"name":"","label":"text","format":"{{msg.payload}}","layout":"row-spread","style":false,"font":"","fontSize":16,"color":"#717171","className":"","x":870,"y":60,"wires":[]},{"id":"db935955d2c92528","type":"ui-text","z":"d1395164b4eec73e","group":"9d83cd8b3d5ee33c","order":2,"width":0,"height":0,"name":"","label":"text","format":"{{msg.payload}}","layout":"row-spread","style":false,"font":"","fontSize":16,"color":"#717171","className":"","x":870,"y":100,"wires":[]},{"id":"9d83cd8b3d5ee33c","type":"ui-group","name":"Group1","page":"c694d0ebe0d2b702","width":"6","height":"1","order":1,"showTitle":true,"className":"","visible":"true","disabled":"false"},{"id":"c694d0ebe0d2b702","type":"ui-page","name":"Page1","ui":"1805777f90e92057","path":"/page1","icon":"home","layout":"grid","theme":"a965ccfef139317a","order":2,"className":"","visible":"true","disabled":"false"},{"id":"1805777f90e92057","type":"ui-base","name":"dashboard","path":"/dashboard","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false},{"id":"a965ccfef139317a","type":"ui-theme","name":"HN Theme","colors":{"surface":"#5c5c5c","primary":"#00fdff","bgPage":"#383838","groupBg":"#4f4f4f","groupOutline":"#858585"},"sizes":{"pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px"}}]

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