# Extracting Context Flow Array from Function Node

**URL:** <https://discourse.nodered.org/t/extracting-context-flow-array-from-function-node/80299>\
**Category:** General\
**Tags:** javascript\
**Created:** [3 August 2023 17:53 UTC](https://discourse.nodered.org/t/extracting-context-flow-array-from-function-node/80299 "2023-08-03T17:53:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![WillShiell](https://avatars.discourse-cdn.com/v4/letter/w/76d3ee/32.png) [@WillShiell](https://discourse.nodered.org/u/WillShiell)\
**Post date:** [3 August 2023 17:53 UTC](https://discourse.nodered.org/t/extracting-context-flow-array-from-function-node/80299/1 "2023-08-03T17:53:41Z")

</div>

Hello I am running into issues attempting to extract my Context Array using the Function Node.

Here is my Flow Context:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/e/de8af6ac8c9d7a3819cdd974205781d7d8ddd459.png)

And here is the function node code I am attempting to use to obtain the array value:

let values = flow.get("values.content");  
return values;

However when I place a debug node to see what is delivered back, I only receive the first value of the array. Is there any documentation describing how to get arrays within Context?

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [3 August 2023 18:56 UTC](https://discourse.nodered.org/t/extracting-context-flow-array-from-function-node/80299/2 "2023-08-03T18:56:36Z")

</div>

You are returning values, an array, so node-red is sending first array value to output one of the function node. All other values are going to output 2, 3, 4, etc . As there are no other outputs you dont see them.  
Try

```auto
msg.values = flow.get("values").content;
Return msg;

```

Your array would then be in msg.values.

[https://nodered.org/docs/user-guide/writing-functions#multiple-messages](https://nodered.org/docs/user-guide/writing-functions#multiple-messages)  
If you are sending a message to one output, you must return an object.  
If you return an array of objects then the objects will be sent to different outputs, whether they exist or not.

---

<div class="post-metadata">

**Author:** ![WillShiell](https://avatars.discourse-cdn.com/v4/letter/w/76d3ee/32.png) [@WillShiell](https://discourse.nodered.org/u/WillShiell)\
**Post date:** [3 August 2023 21:44 UTC](https://discourse.nodered.org/t/extracting-context-flow-array-from-function-node/80299/3 "2023-08-03T21:44:14Z")

</div>

Appreciate the help @E1cid! That was the solution.

---

<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:** [17 August 2023 21:44 UTC](https://discourse.nodered.org/t/extracting-context-flow-array-from-function-node/80299/4 "2023-08-17T21:44:18Z")

</div>

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