# How to split array in function pallete

**URL:** <https://discourse.nodered.org/t/how-to-split-array-in-function-pallete/20733>\
**Category:** General\
**Created:** [22 January 2020 16:32 UTC](https://discourse.nodered.org/t/how-to-split-array-in-function-pallete/20733 "2020-01-22T16:32:12Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Artwin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/artwin/32/16403_2.png) [@Artwin](https://discourse.nodered.org/u/Artwin)\
**Post date:** [22 January 2020 16:32 UTC](https://discourse.nodered.org/t/how-to-split-array-in-function-pallete/20733/1 "2020-01-22T16:32:12Z")

</div>

Hi my name artwin,  
can you help me solve this problem, I have a join palette that contains an array with two values, then I want to split the two values ​​in the array into two variables, how do I do that?

 ![Screenshot_1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/d/fd2326e0ad6b73bbd1a5911d76b966adf1f03e44.png)  
Thanks

---

<div class="post-metadata">

**Author:** ![Lavio](https://avatars.discourse-cdn.com/v4/letter/l/d6d6ee/32.png) [@Lavio](https://discourse.nodered.org/u/Lavio)\
**Post date:** [22 January 2020 16:38 UTC](https://discourse.nodered.org/t/how-to-split-array-in-function-pallete/20733/2 "2020-01-22T16:38:30Z")

</div>

can you show the code? you have used

---

<div class="post-metadata">

**Author:** ![Artwin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/artwin/32/16403_2.png) [@Artwin](https://discourse.nodered.org/u/Artwin)\
**Post date:** [22 January 2020 16:42 UTC](https://discourse.nodered.org/t/how-to-split-array-in-function-pallete/20733/3 "2020-01-22T16:42:08Z")

</div>

![Screenshot_2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/2/a2fa79ed4078e024ff9c4334d4c15b893f65dd85.png)

---

<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:** [22 January 2020 16:48 UTC](https://discourse.nodered.org/t/how-to-split-array-in-function-pallete/20733/4 "2020-01-22T16:48:52Z")

</div>

How have you got the Join node configured? You might be better to use key/value pairs then they will already be identified by topic contents.

---

<div class="post-metadata">

**Author:** ![Artwin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/artwin/32/16403_2.png) [@Artwin](https://discourse.nodered.org/u/Artwin)\
**Post date:** [22 January 2020 16:54 UTC](https://discourse.nodered.org/t/how-to-split-array-in-function-pallete/20733/5 "2020-01-22T16:54:10Z")

</div>

how do you get the value from the topic? I have replaced the join with key / value

---

<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:** [22 January 2020 17:00 UTC](https://discourse.nodered.org/t/how-to-split-array-in-function-pallete/20733/6 "2020-01-22T17:00:05Z")

</div>

Make sure the two messages coming in have different topics, then feed the output of the join into a debug node. What do you see?

---

<div class="post-metadata">

**Author:** ![Lavio](https://avatars.discourse-cdn.com/v4/letter/l/d6d6ee/32.png) [@Lavio](https://discourse.nodered.org/u/Lavio)\
**Post date:** [22 January 2020 17:00 UTC](https://discourse.nodered.org/t/how-to-split-array-in-function-pallete/20733/7 "2020-01-22T17:00:28Z")

</div>

in your node-red you have a button called deploy in the right of that button you have the tree lines you clic in them and then export, clipboard in the flows you selected and then send

---

<div class="post-metadata">

**Author:** ![Artwin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/artwin/32/16403_2.png) [@Artwin](https://discourse.nodered.org/u/Artwin)\
**Post date:** [22 January 2020 18:32 UTC](https://discourse.nodered.org/t/how-to-split-array-in-function-pallete/20733/8 "2020-01-22T18:32:04Z")

</div>

![Screenshot_3](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/5/d56f3398836a571cf6321cff09e1333010c2f444.png)  
Solved thanks @Colin & @Lavio to reference

---

<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:** [22 January 2020 18:47 UTC](https://discourse.nodered.org/t/how-to-split-array-in-function-pallete/20733/9 "2020-01-22T18:47:37Z")

</div>

How do you know they will always be that way round (the [0] and [1])?

---

<div class="post-metadata">

**Author:** ![Artwin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/artwin/32/16403_2.png) [@Artwin](https://discourse.nodered.org/u/Artwin)\
**Post date:** [22 January 2020 18:53 UTC](https://discourse.nodered.org/t/how-to-split-array-in-function-pallete/20733/10 "2020-01-22T18:53:38Z")

</div>

hmm, you are right,  
I have to try with key / value

---

<div class="post-metadata">

**Author:** ![Artwin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/artwin/32/16403_2.png) [@Artwin](https://discourse.nodered.org/u/Artwin)\
**Post date:** [22 January 2020 18:57 UTC](https://discourse.nodered.org/t/how-to-split-array-in-function-pallete/20733/11 "2020-01-22T18:57:12Z")

</div>

@Colin  
Can you give an example of join with key / value with the next node, which is the function node to separate these values?

---

<div class="post-metadata">

**Author:** ![Artwin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/artwin/32/16403_2.png) [@Artwin](https://discourse.nodered.org/u/Artwin)\
**Post date:** [22 January 2020 19:10 UTC](https://discourse.nodered.org/t/how-to-split-array-in-function-pallete/20733/12 "2020-01-22T19:10:56Z")

</div>

![Screenshot_4](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/8/b83cbfc5b2cdde48f9687a67f2a07f9dec931563.png)  
Solved with join key/values,  
thank you very much for the correction of my algorithm
