# Send information only by pressing a button "Speichern"

**URL:** <https://discourse.nodered.org/t/send-information-only-by-pressing-a-button-speichern/49863>\
**Category:** General\
**Created:** [18 August 2021 08:23 UTC](https://discourse.nodered.org/t/send-information-only-by-pressing-a-button-speichern/49863 "2021-08-18T08:23:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ClemensSimon](https://avatars.discourse-cdn.com/v4/letter/c/b2d939/32.png) [@ClemensSimon](https://discourse.nodered.org/u/ClemensSimon)\
**Post date:** [18 August 2021 08:23 UTC](https://discourse.nodered.org/t/send-information-only-by-pressing-a-button-speichern/49863/1 "2021-08-18T08:23:13Z")

</div>

**Dear Node-Red´s**

**I do have a problem to hand off informations only if a "Store" button is pressed. My flow looks like this:**

 ![Screenshot 2021-08-18 100336](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/3/e32c97736f627862e559595853f86efdbfa0243f.jpeg)

[{"id":"46f3fadcb97268ab","type":"ui\_button","z":"84622180359efd62","name":"Speichern","group":"7763f99169395494","order":13,"width":0,"height":0,"passthru":true,"label":"Speichern/store","tooltip":"Speichert die Daten in der Datenbank","color":"","bgcolor":"{{colour}}","icon":"","payload":"true","payloadType":"bool","topic":"payload","topicType":"msg","x":560,"y":880,"wires":[["56df29454df9d063"]]},{"id":"56df29454df9d063","type":"trigger","z":"84622180359efd62","name":"","op1":"true","op2":"false","op1type":"bool","op2type":"bool","duration":"1","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":800,"y":880,"wires":[["98e21e25054d9623"]]},{"id":"0e353c3e8a65bd44","type":"inject","z":"84622180359efd62","name":"Store","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":360,"y":880,"wires":[["46f3fadcb97268ab"]]},{"id":"9790e28241b2bd8d","type":"debug","z":"84622180359efd62","name":"store (true/false)","active":false,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1320,"y":880,"wires":},{"id":"98e21e25054d9623","type":"function","z":"84622180359efd62","name":"speichern","func":"var e=msg.payload;\nglobal.set("speichern", e) ; //Input in Variable speichern \nmsg.payload =e,"Speichern";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":,"x":1040,"y":880,"wires":[["9790e28241b2bd8d"]]},{"id":"138ea281f71d60a5","type":"function","z":"84622180359efd62","name":"Transfer info after "Speichern" is pressed","func":"// This node should send the input thrue if speichern is true \n\nif (global.get("speichern")==true) {\n return msg;\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":,"x":1040,"y":680,"wires":[["9a2743aac464f89e"]]},{"id":"9a2743aac464f89e","type":"debug","z":"84622180359efd62","name":"Speichern","active":false,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1320,"y":680,"wires":},{"id":"4858a82a295aa484","type":"ui\_dropdown","z":"84622180359efd62","name":"Test input","label":"Test input","tooltip":"","place":"0","group":"7763f99169395494","order":6,"width":0,"height":0,"passthru":true,"multiple":false,"options":[{"label":"0,0","value":"0,0","type":"str"},{"label":"0,1","value":"0,1","type":"str"},{"label":"0,5","value":"0,5","type":"str"},{"label":"1,0","value":"1,0","type":"str"},{"label":"5,0","value":"5,0","type":"str"}],"payload":"","topic":"Test","topicType":"str","x":520,"y":680,"wires":[["10a88fb2008e0ae3","138ea281f71d60a5"]]},{"id":"344c311e7f9cadfd","type":"inject","z":"84622180359efd62","name":"1","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Pruefdruck","payload":"1,0","payloadType":"str","x":350,"y":720,"wires":[["4858a82a295aa484"]]},{"id":"1cc030a74f89eae7","type":"inject","z":"84622180359efd62","name":"5","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Pruefdruck","payload":"5,0","payloadType":"str","x":350,"y":760,"wires":[["4858a82a295aa484"]]},{"id":"06fbd0626802fa7a","type":"inject","z":"84622180359efd62","name":"0,5","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Pruefdruck","payload":"0,5","payloadType":"str","x":350,"y":680,"wires":[["4858a82a295aa484"]]},{"id":"0b10235f72d3629c","type":"inject","z":"84622180359efd62","name":"0,1","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Pruefdruck","payload":"0,1","payloadType":"str","x":350,"y":640,"wires":[["4858a82a295aa484"]]},{"id":"ec246cd684064818","type":"inject","z":"84622180359efd62","name":"0,0","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Pruefdruck","payload":"0,0","payloadType":"str","x":350,"y":600,"wires":[["4858a82a295aa484"]]},{"id":"10a88fb2008e0ae3","type":"debug","z":"84622180359efd62","name":"Choice","active":false,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":730,"y":640,"wires":},{"id":"45894a54ee438d43","type":"comment","z":"84622180359efd62","name":"Create a Variable to serve the "Store" information to all nodes","info":"","x":490,"y":840,"wires":},{"id":"30687fc843b5dfb4","type":"comment","z":"84622180359efd62","name":"Input","info":"","x":510,"y":600,"wires":},{"id":"9502cb7ba3de449d","type":"comment","z":"84622180359efd62","name":"Function which should transfer informations if store== true ","info":"","x":1050,"y":640,"wires":},{"id":"3ecf675016fdfbf3","type":"comment","z":"84622180359efd62","name":"Problem: This Button needs a Trigger (new Information) but the Information is alread at the input","info":"","x":1160,"y":720,"wires":},{"id":"7763f99169395494","type":"ui\_group","name":"Group 1","tab":"dde642b08fea7c32","order":1,"disp":true,"width":6},{"id":"dde642b08fea7c32","type":"ui\_tab","name":"Test","icon":"dashboard","order":8,"disabled":false,"hidden":false}]

Please can you help.

Thanks in advance Clemens

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [18 August 2021 22:05 UTC](https://discourse.nodered.org/t/send-information-only-by-pressing-a-button-speichern/49863/2 "2021-08-18T22:05:33Z")

</div>

You need to _format_ the code correctly when posting.

If I am reading what you said correctly:

inputs are giving you information and you only want it stored if you press a button?

Question though:

How fast is the information arriving?

If it is arriving too quickly there will be problems.

Putting that aside:  
A message arrives. It is _stored_ and if you press _the button_ it is saved.

You can do this a couple of ways.  
But basically the idea is like this:

Message arrives.  
_Store_ the message in context.  
If you press the button, that message is then passed to the output - to the next node.  
Otherwise just store the next message when it arrives.

---

<div class="post-metadata">

**Author:** ![Mrb32](https://avatars.discourse-cdn.com/v4/letter/m/cdc98d/32.png) [@Mrb32](https://discourse.nodered.org/u/Mrb32)\
**Post date:** [18 August 2021 22:10 UTC](https://discourse.nodered.org/t/send-information-only-by-pressing-a-button-speichern/49863/3 "2021-08-18T22:10:19Z")

</div>

I use the Q-gate node ([here](https://flows.nodered.org/node/node-red-contrib-queue-gate)) for this type of things... It stores messages based on various conditions and can be setup to release messages via a trigger message sent when a button is pressed.

---

<div class="post-metadata">

**Author:** ![ClemensSimon](https://avatars.discourse-cdn.com/v4/letter/c/b2d939/32.png) [@ClemensSimon](https://discourse.nodered.org/u/ClemensSimon)\
**Post date:** [19 August 2021 06:23 UTC](https://discourse.nodered.org/t/send-information-only-by-pressing-a-button-speichern/49863/4 "2021-08-19T06:23:08Z")

</div>

Dear all  
thanks a lot for your feedback. I will look for the Q-Gate button, which seems to solve my problem.  
... meanwhile  
after a lot of testing I solved my problem by adding a trigger node infront of the store function. This trigger node fires every 0,5 s the information into the store function and wenn the "Go" Signal arives the Stor function sends out the stored message.

Problem solved  
You can close this treat

---

<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:** [2 September 2021 06:23 UTC](https://discourse.nodered.org/t/send-information-only-by-pressing-a-button-speichern/49863/5 "2021-09-02T06:23:15Z")

</div>

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