# I only want to save the last number - filelog

**URL:** <https://discourse.nodered.org/t/i-only-want-to-save-the-last-number-filelog/16180>\
**Category:** General\
**Created:** [2 October 2019 07:09 UTC](https://discourse.nodered.org/t/i-only-want-to-save-the-last-number-filelog/16180 "2019-10-02T07:09:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Venom](https://avatars.discourse-cdn.com/v4/letter/v/8c91f0/32.png) [@Venom](https://discourse.nodered.org/u/Venom)\
**Post date:** [2 October 2019 07:09 UTC](https://discourse.nodered.org/t/i-only-want-to-save-the-last-number-filelog/16180/1 "2019-10-02T07:09:44Z")

</div>

Hello I have made a flow where it saves the temperatur/number with date. The thing is that I only want it to save the last temperatur but it saves every temperatur when I click on the save button. example: I input number and click save. It saves that number/temperatur and the time. I then type a new number and hit enter. Before I save log I enter a new number and hit enter. Then it saves the 2 last temperatures/numbers and the date but I want the date for each number and in this case it saves two numbers and the date for when I clicked save(10, 45 + date).

New user so I can only copy/past code: [{"id":"9e5f1775.c74128","type":"tab","label":"Test","disabled":false,"info":""},{"id":"92b7338a.064498","type":"function","z":"9e5f1775.c74128","name":"temp conversion","func":"var number = msg.payload;\nvar temp1 = Math.log(number/1024)/-0.028;\nvar temp2 = temp1.toFixed(2);\nmsg.payload = temp2;\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":120,"wires":[["33d13e44.cb906a","4f9a9db0.12a314"]]},{"id":"33d13e44.cb906a","type":"ui\_gauge","z":"9e5f1775.c74128","name":"","group":"92b49ed9.d3728","order":3,"width":0,"height":0,"gtype":"gage","title":"Temperatur","label":"units","format":"{{msg.payload}}","min":"0","max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":710,"y":120,"wires":},{"id":"6630890e.a75d18","type":"simpletime","z":"9e5f1775.c74128","name":"","x":410,"y":300,"wires":[["4f9a9db0.12a314"]]},{"id":"4f9a9db0.12a314","type":"template","z":"9e5f1775.c74128","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload}} {{mytime}} {{mydate}}","output":"str","x":660,"y":280,"wires":[["c0965be1.9f0f4"]]},{"id":"c0965be1.9f0f4","type":"file","z":"9e5f1775.c74128","name":"Logfil","filename":"C:\Users\benja\.node-red\saveit.txt","appendNewline":true,"createDir":false,"overwriteFile":"false","encoding":"none","x":890,"y":280,"wires":[]},{"id":"9a23d316.9d47a8","type":"ui\_button","z":"9e5f1775.c74128","name":"Gem log","group":"92b49ed9.d3728","order":1,"width":0,"height":0,"passthru":false,"label":"Gem log","tooltip":"","color":"","bgcolor":"","icon":"","payload":" ","payloadType":"str","topic":"","x":140,"y":320,"wires":[["6630890e.a75d18"]]},{"id":"69462a0a.8b8cc4","type":"ui\_text\_input","z":"9e5f1775.c74128","name":"","label":"","tooltip":"","group":"92b49ed9.d3728","order":11,"width":0,"height":0,"passthru":true,"mode":"number","delay":"0","topic":"","x":130,"y":120,"wires":[["92b7338a.064498"]]},{"id":"92b49ed9.d3728","type":"ui\_group","z":"","name":"Default","tab":"d5e92c99.dcad28","disp":true,"width":"6","collapse":false},{"id":"d5e92c99.dcad28","type":"ui\_tab","z":"","name":"Default","icon":"dashboard","disabled":false,"hidden":false}]

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [2 October 2019 07:29 UTC](https://discourse.nodered.org/t/i-only-want-to-save-the-last-number-filelog/16180/2 "2019-10-02T07:29:03Z")

</div>

You indeed can copy and paste, but please export your flow again and follow this post and edit your post:

> [@How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506):
>
> To share code samples or flow json in this forum, you need to take care to format it properly so that it is displayed correctly. The easiest way to do that is to click the 'Preformatted Text' button in the toolbar: [image] Then paste in your code or flow json. You should end up with three back-tick characters - ``` - on their own line before and after the code. On standard US English keyboards, this is on the same key as the ~ character. Using the backticks will ens…

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 October 2019 09:35 UTC](https://discourse.nodered.org/t/i-only-want-to-save-the-last-number-filelog/16180/3 "2019-10-02T09:35:55Z")

</div>

As @bakman2 says we can't import your flow until you edit your previous post, but if you are saving to a file look at the options in the Action field in the File node.
