# What am I doing wrong?

**URL:** <https://discourse.nodered.org/t/what-am-i-doing-wrong/82982>\
**Category:** General\
**Created:** [18 November 2023 09:35 UTC](https://discourse.nodered.org/t/what-am-i-doing-wrong/82982 "2023-11-18T09:35:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [18 November 2023 09:35 UTC](https://discourse.nodered.org/t/what-am-i-doing-wrong/82982/1 "2023-11-18T09:35:37Z")

</div>

Why is the top inject not being routed to top debug node?  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/3/733dd1cc14eeb959c62577647b8cb061caedf0c4.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/4/d4fb457cbf512aa82288206b28f11a80d12302ce.png)

```auto
[{"id":"c82cdbdd3cd2858e","type":"inject","z":"d760e2801b9ca31b","name":"t","props":[{"p":"payload"},{"p":"payload.init","v":"true","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":450,"y":440,"wires":[["feb42620f9c78f42"]]},{"id":"3db68cff3103c40b","type":"inject","z":"d760e2801b9ca31b","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":460,"y":520,"wires":[["feb42620f9c78f42"]]},{"id":"feb42620f9c78f42","type":"switch","z":"d760e2801b9ca31b","name":"","property":"payload.init","propertyType":"msg","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":630,"y":480,"wires":[["6109b3a8c0bf2943"],["fccfdfb7a99db3f5"]]},{"id":"d781488b1a11604d","type":"inject","z":"d760e2801b9ca31b","name":"f","props":[{"p":"payload"},{"p":"payload.init","v":"false","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":450,"y":480,"wires":[["feb42620f9c78f42"]]},{"id":"6109b3a8c0bf2943","type":"debug","z":"d760e2801b9ca31b","name":"debug top","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":810,"y":470,"wires":[]},{"id":"fccfdfb7a99db3f5","type":"debug","z":"d760e2801b9ca31b","name":"debug bottom","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":830,"y":520,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [18 November 2023 09:40 UTC](https://discourse.nodered.org/t/what-am-i-doing-wrong/82982/2 "2023-11-18T09:40:09Z")

</div>

you can't set payload to be a number and then add a sub property to it... add a debug to the inject and see what it is sending.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [18 November 2023 09:41 UTC](https://discourse.nodered.org/t/what-am-i-doing-wrong/82982/3 "2023-11-18T09:41:27Z")

</div>

Of course I can't #LOL

I was having trouble in a real flow so knocked this up for testing and forgot Rule 1 :

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/e/de32bf349f320b2ac201944528ed642d1df29a1a.png)

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [18 November 2023 09:46 UTC](https://discourse.nodered.org/t/what-am-i-doing-wrong/82982/4 "2023-11-18T09:46:47Z")

</div>

If you create a specific Date object then yes you can add to it...

```auto
[{"id":"34c17f2f1a31a93f","type":"inject","z":"826d685ea5de20db","name":"t2","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":110,"y":460,"wires":[["0b6180836635685b"]]},{"id":"0b6180836635685b","type":"function","z":"826d685ea5de20db","name":"function 1","func":"msg.payload = new Date();\nmsg.payload.init = true;\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":260,"y":460,"wires":[["bcdb1a2024a16729","feb42620f9c78f42"]]}]

```

.. but hey - it's a function node 😉

---

<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:** [2 December 2023 09:46 UTC](https://discourse.nodered.org/t/what-am-i-doing-wrong/82982/5 "2023-12-02T09:46:59Z")

</div>

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