# How to get an array value from flow context

**URL:** <https://discourse.nodered.org/t/how-to-get-an-array-value-from-flow-context/80128>\
**Category:** General\
**Created:** [28 July 2023 04:24 UTC](https://discourse.nodered.org/t/how-to-get-an-array-value-from-flow-context/80128 "2023-07-28T04:24:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Akshay51](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@Akshay51](https://discourse.nodered.org/u/Akshay51)\
**Post date:** [28 July 2023 04:24 UTC](https://discourse.nodered.org/t/how-to-get-an-array-value-from-flow-context/80128/1 "2023-07-28T04:24:35Z")

</div>

Hi,  
I wsa trying to get a particular array value from the flow context, but i could only get the whole values in the array instead of a particular value.

I was using

> `msg.payload = flow.get("testCheck",[0]);`

to get the value but no hope.  
Any help is appreciated. Thanks in advance

![Inkedwfica32_AGnEQefxwZ](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/6/0627680288514bdbc5435c03ac30ef9a6d4493ad.jpeg)

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [28 July 2023 05:04 UTC](https://discourse.nodered.org/t/how-to-get-an-array-value-from-flow-context/80128/2 "2023-07-28T05:04:15Z")

</div>

> [@Akshay51](#):
>
> msg.payload = flow.get("testCheck",[0]);

flow.get accepts a single argument, the variable.  
The variable contains an array and you want the first element:

```auto
const myFlowVariable = flow.get("testCheck")
msg.payload = myFlowVariable[0]

// or if you want the short version:

msg.payload = flow.get("testCheck")[0]

```

---

<div class="post-metadata">

**Author:** ![Akshay51](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@Akshay51](https://discourse.nodered.org/u/Akshay51)\
**Post date:** [28 July 2023 07:28 UTC](https://discourse.nodered.org/t/how-to-get-an-array-value-from-flow-context/80128/3 "2023-07-28T07:28:30Z")

</div>

Thanks for the quick reply @bakman2

---

<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:** [11 August 2023 07:29 UTC](https://discourse.nodered.org/t/how-to-get-an-array-value-from-flow-context/80128/4 "2023-08-11T07:29:14Z")

</div>

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