# I'm not seeing the elephant - code help

**URL:** <https://discourse.nodered.org/t/im-not-seeing-the-elephant-code-help/76973>\
**Category:** General\
**Created:** [27 March 2023 01:53 UTC](https://discourse.nodered.org/t/im-not-seeing-the-elephant-code-help/76973 "2023-03-27T01:53:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 March 2023 01:53 UTC](https://discourse.nodered.org/t/im-not-seeing-the-elephant-code-help/76973/1 "2023-03-27T01:53:04Z")

</div>

Given the message structure is correct:

I am not understanding why I am not seeing the correct output.

```auto
// msg.existing is the EXISTING value for the LEDs
// Split the payload.
const check = msg.payload.split(",");

node.warn("Wipe " + msg.wipe);

let msg1 = {};

let led = check[1];
if (led != 0)
{
    node.warn("LED " + led);
    //node.warn(msg.existing);
    let value = msg.existing[led];
    node.warn("Value " + value);
    let x = led + ',' + value;
    node.warn("x is " + x);
    msg1 = {"payload":"rgb," + led + ',' + value};
    node.warn("msg1 " + msg1);
}

if (msg.wipe == "OLD")
{
    return [msg.msg1];
}
else
return [msg,null];

```

 ![Screenshot from 2023-03-27 12-50-04](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/e/6ecad3199aa4d454ab0378977dcdf1fb46e61b75.png)

I have a fear I am going to kick myself.

But I'm not too proud to admit I am not seeing the cause.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 March 2023 02:07 UTC](https://discourse.nodered.org/t/im-not-seeing-the-elephant-code-help/76973/2 "2023-03-27T02:07:50Z")

</div>

FOUND IT!

`return [msg.msg1]`  
and not  
`return [msg,msg1]`

SORRY!

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [27 March 2023 07:18 UTC](https://discourse.nodered.org/t/im-not-seeing-the-elephant-code-help/76973/3 "2023-03-27T07:18:39Z")

</div>

> [@Trying\_to\_learn](#):
>
> `return [msg.msg1]`  
> and not  
> `return [msg,msg1]`

Isn't it the other way around?

`return [msg,msg1]`  
and not  
`return [msg.msg1]`

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 March 2023 08:02 UTC](https://discourse.nodered.org/t/im-not-seeing-the-elephant-code-help/76973/4 "2023-03-27T08:02:54Z")

</div>

Well, I was saying it in the context of what I had and what I should have put.

So I said I had (originally) `return [msg.msg1]` rather than `return msg, msg1]`

AND! I found it all by myself - which is kind of good.

---

<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:** [10 April 2023 08:03 UTC](https://discourse.nodered.org/t/im-not-seeing-the-elephant-code-help/76973/5 "2023-04-10T08:03:12Z")

</div>

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