# Read data from different payloads

**URL:** <https://discourse.nodered.org/t/read-data-from-different-payloads/8306>\
**Category:** General\
**Created:** [23 February 2019 17:46 UTC](https://discourse.nodered.org/t/read-data-from-different-payloads/8306 "2019-02-23T17:46:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Umang](https://avatars.discourse-cdn.com/v4/letter/u/db5fbb/32.png) [@Umang](https://discourse.nodered.org/u/Umang)\
**Post date:** [23 February 2019 17:46 UTC](https://discourse.nodered.org/t/read-data-from-different-payloads/8306/1 "2019-02-23T17:46:19Z")

</div>

Ok, I am a beginner and was just wondering that if i have 3 different injects(day,month year) and want to make a function to take these data from all these different payloads and when all 3 are clicked give output ad a complete date(dd/mm/yyyy). So is this even possible? And if yes please do help.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [23 February 2019 17:56 UTC](https://discourse.nodered.org/t/read-data-from-different-payloads/8306/2 "2019-02-23T17:56:41Z")

</div>

Yes, it is possible but it isn't really the "Node-RED way".

To do it, you need to save all 3 inputs to flow or global variables then you can use a function node or a change node (using JSONata) to join them together.

You might want to ask yourself however, why use 3 injects that force you to join stuff together when you could have 1 inject with all 3 pieces of information together?

---

<div class="post-metadata">

**Author:** ![Umang](https://avatars.discourse-cdn.com/v4/letter/u/db5fbb/32.png) [@Umang](https://discourse.nodered.org/u/Umang)\
**Post date:** [23 February 2019 18:11 UTC](https://discourse.nodered.org/t/read-data-from-different-payloads/8306/3 "2019-02-23T18:11:39Z")

</div>

Thanks for the help. Is there any resource where I can learn how to use node red perfectly? I am very much beginner and want to learn it perfectly.

---

<div class="post-metadata">

**Author:** ![Andrei](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andrei/32/10446_2.png) [@Andrei](https://discourse.nodered.org/u/Andrei)\
**Post date:** [23 February 2019 18:51 UTC](https://discourse.nodered.org/t/read-data-from-different-payloads/8306/4 "2019-02-23T18:51:06Z")

</div>

Here another alternative to the first solution.

![r-01](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/4/4d9a7f94fcb5a50470d32d6b75be6d0722527d52.png)

The join node will create an object with the three input (and every time an input is entered). The template node will create a string from the object.

```auto
[{"id":"be0fcc2e.ef7c8","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"5f1a0900.abc798","type":"inject","z":"be0fcc2e.ef7c8","name":"","topic":"day","payload":"DD","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":140,"wires":[["7f8bf4df.da9fac"]]},{"id":"a243ee87.0a727","type":"inject","z":"be0fcc2e.ef7c8","name":"","topic":"month","payload":"MM","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":180,"wires":[["7f8bf4df.da9fac"]]},{"id":"3ae58f90.3d478","type":"inject","z":"be0fcc2e.ef7c8","name":"","topic":"year","payload":"YY","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":220,"wires":[["7f8bf4df.da9fac"]]},{"id":"7f8bf4df.da9fac","type":"join","z":"be0fcc2e.ef7c8","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":330,"y":180,"wires":[["c24145ec.a8aab8"]]},{"id":"84855f1a.3180f","type":"debug","z":"be0fcc2e.ef7c8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":610,"y":180,"wires":[]},{"id":"c24145ec.a8aab8","type":"template","z":"be0fcc2e.ef7c8","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload.day}}/{{payload.month}}/{{payload.year}}","output":"str","x":460,"y":180,"wires":[["84855f1a.3180f"]]}]

```
