# Increment a flow.get

**URL:** <https://discourse.nodered.org/t/increment-a-flow-get/12743>\
**Category:** General\
**Created:** [30 June 2019 11:23 UTC](https://discourse.nodered.org/t/increment-a-flow-get/12743 "2019-06-30T11:23:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dave/32/10827_2.png) [@Dave](https://discourse.nodered.org/u/Dave)\
**Post date:** [30 June 2019 11:23 UTC](https://discourse.nodered.org/t/increment-a-flow-get/12743/1 "2019-06-30T11:23:16Z")

</div>

I have had a strange issue, which I don't understand, I have the following in a function node

flow.set('count',flow.get('count')+1);

normally it works fine like flow.set('count') = 1 then 2 then 3 etc however for some unknown reason it started producing 34111111111111111 clearly its inserting 1's on the end of 34 not adding 1 to 34 I haven't reproduced this yet, but does anyone have an idea what circumstance would cause this ?

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [30 June 2019 11:29 UTC](https://discourse.nodered.org/t/increment-a-flow-get/12743/2 "2019-06-30T11:29:04Z")

</div>

if somewhere else you have set it to be a string rather than a number

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [30 June 2019 11:43 UTC](https://discourse.nodered.org/t/increment-a-flow-get/12743/3 "2019-06-30T11:43:35Z")

</div>

Use `parseInt()`

---

<div class="post-metadata">

**Author:** ![Dave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dave/32/10827_2.png) [@Dave](https://discourse.nodered.org/u/Dave)\
**Post date:** [30 June 2019 11:56 UTC](https://discourse.nodered.org/t/increment-a-flow-get/12743/4 "2019-06-30T11:56:27Z")

</div>

Yes,,, I found it, I send the number/result to a file and I can see in the file its a number, if node red is reset it gets the file contents  
if(msg.filename=="datalog/count"){  
flow.set('count',msg.payload);  
}  
but that returns a string (don't know why but I can fix it , thanks for the heads up you saved me a bunch of time trying to track this issue down.)  
msg : Object  
{ \_msgid: "f4ebcfa.f7a9b3", topic: "", payload: "1242", filename: "datalog/count" }

and yes parseInt

if(msg.filename=="datalog/usage"){  
msg.payload=parseInt(msg.payload);  
return msg;  
}
