# Function node and merge

**URL:** https://discourse.nodered.org/t/function-node-and-merge/21991
**Category:** General
**Created:** [19 February 2020 16:54 UTC](https://discourse.nodered.org/t/function-node-and-merge/21991 "2020-02-19T16:54:22Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![pvklink](https://avatars.discourse-cdn.com/v4/letter/p/46a35a/32.png) [@pvklink](https://discourse.nodered.org/u/pvklink)
#### Post date: [19 February 2020 16:54 UTC](https://discourse.nodered.org/t/function-node-and-merge/21991/1 "2020-02-19T16:54:22Z")

</div>

I need to convert an array to seperate vars and keep the old message.  
this is how i solved it but i think there is a better way to include the old message in the new one other then include all vars one by one....like i did...

var msg\_copy = RED.util.cloneMessage(msg); // menu,  
msg = JSON.parse(JSON.stringify(msg.fq[msg.fq\_a]));

// define the old msg again from the copy  
msg.fq = msg\_copy.fq;  
msg.fq\_l = msg\_copy.fq\_l;  
msg.fq\_a = msg\_copy.fq\_a;

return msg;

---

<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: [19 April 2020 16:54 UTC](https://discourse.nodered.org/t/function-node-and-merge/21991/2 "2020-04-19T16:54:27Z")

</div>

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