Extracting Context Flow Array from Function Node

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

Here is my Flow Context:
image

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?

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

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
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.

3 Likes

Appreciate the help @E1cid! That was the solution.

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