# Function not modifying payload

**URL:** <https://discourse.nodered.org/t/function-not-modifying-payload/12953>\
**Category:** General\
**Created:** [5 July 2019 13:52 UTC](https://discourse.nodered.org/t/function-not-modifying-payload/12953 "2019-07-05T13:52:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![injector22](https://avatars.discourse-cdn.com/v4/letter/i/e9bcb4/32.png) [@injector22](https://discourse.nodered.org/u/injector22)\
**Post date:** [5 July 2019 13:52 UTC](https://discourse.nodered.org/t/function-not-modifying-payload/12953/1 "2019-07-05T13:52:23Z")

</div>

I'm trying to use a function with an IF statement to modify the payload on a message but for some reason I can't get the payload to change. I used the switch node to make sure I had the correct path to the array returned by the mysql node and that was fine. But the function just keeps returning the output from the mysql node instead.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/2/2e036ca654f6973b87ea53c2766bd035a2164579.png)

---

<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:** [5 July 2019 14:03 UTC](https://discourse.nodered.org/t/function-not-modifying-payload/12953/2 "2019-07-05T14:03:54Z")

</div>

It's because neither your if nor your else match.

Add a debug node before this function node to see what is actually in msg.payload.

Alternatively, are an else clause.

---

<div class="post-metadata">

**Author:** ![injector22](https://avatars.discourse-cdn.com/v4/letter/i/e9bcb4/32.png) [@injector22](https://discourse.nodered.org/u/injector22)\
**Post date:** [5 July 2019 14:05 UTC](https://discourse.nodered.org/t/function-not-modifying-payload/12953/3 "2019-07-05T14:05:41Z")

</div>

S.O.B, I knew it was something simple. I added another else if with \<= 3.7 and it's all good now.

I feel stupid now.
