# Data from one function to another function

**URL:** <https://discourse.nodered.org/t/data-from-one-function-to-another-function/85830>\
**Category:** General\
**Created:** [23 February 2024 19:27 UTC](https://discourse.nodered.org/t/data-from-one-function-to-another-function/85830 "2024-02-23T19:27:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pcwortex](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pcwortex/32/88588_2.png) [@pcwortex](https://discourse.nodered.org/u/pcwortex)\
**Post date:** [23 February 2024 19:27 UTC](https://discourse.nodered.org/t/data-from-one-function-to-another-function/85830/1 "2024-02-23T19:27:19Z")

</div>

Hi community,  
I have this diagram which shows below.

 ![diagram](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/2/7264ce8752fd1b579fe3c045fcd5e8fccf49d4d0.jpeg)  
I want this data, which is drawn in red color from the Antena\_1 function node output, to be sent to the input of the antena1\_sat function node.  
 ![message](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/4/a4440d936e59b56fdf92567c3f9cb878b6b529ea.jpeg)  
How I can do it?

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [23 February 2024 19:43 UTC](https://discourse.nodered.org/t/data-from-one-function-to-another-function/85830/2 "2024-02-23T19:43:10Z")

</div>

Welcome to the forums @pcwortex

Lets assume the array index NEVER changes:

in `Antena_1`

```auto
msg.payload = msg.payload[7]
return msg

```

Then connect `Antena_1` to `Antena1_sat`

The `msg.payload` in `Antena1_sat` will then inndeed be that date

All you are doing is passing an object along - so manipulate that object, as it travels...

I do suggest using the `change` node for this (between `Antena_1` & `Antena1_sat`) - but still, it should hopefully make sense

Note: I removed this from **Dashboard** - as it doesn't seem related

---

<div class="post-metadata">

**Author:** ![pcwortex](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pcwortex/32/88588_2.png) [@pcwortex](https://discourse.nodered.org/u/pcwortex)\
**Post date:** [25 February 2024 18:50 UTC](https://discourse.nodered.org/t/data-from-one-function-to-another-function/85830/3 "2024-02-25T18:50:00Z")

</div>

> [@marcus-j-davies](#):
>
> `msg.payload[7]`

My function antena1\_sat has code like this

```auto
var tema = msg.topic;
var zinute = msg.payload;
var eilute = msg.payload;
var rezultatai = eilute.match(/\$GPGSA,([A]),(\d+),([0-9,.-]+),(\d+\.\d+),(\d+\.\d+),(\d+\.\d+)\*([0-9A-F]{2})/);
if (rezultatai) {
        msg.payload = [zinute,rezultatai[3]]       
} else {
      msg.payload = "Nerasta atitikimo";
}
msg.topic = "INSERT INTO Antena1_sat(Message,Satelites) VALUES (?,?)";
return msg;

```

I want take data from function `Antena_1 msg.payload[7]` and put to `antena1_sat msg.topic = "INSERT INTO Antena1_sat(Antena_1_msg.payload[7],Message,Satelites) VALUES (?,?,?)";`  
But how do that I don't image.  
I can connect `Antena_1` to `Antena1_sat`. Then, I receive two messages simultaneously, but the function runs twice: once when receiving data from the switch mode and another time when receiving data from `Antena_1 msg.payload[7]`

---

<div class="post-metadata">

**Author:** ![gerry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gerry/32/21604_2.png) [@gerry](https://discourse.nodered.org/u/gerry)\
**Post date:** [25 February 2024 19:26 UTC](https://discourse.nodered.org/t/data-from-one-function-to-another-function/85830/4 "2024-02-25T19:26:58Z")

</div>

if the issue is just two identical messages there is a core node called filter you can set to block messages unless the msg changes

---

<div class="post-metadata">

**Author:** ![pcwortex](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pcwortex/32/88588_2.png) [@pcwortex](https://discourse.nodered.org/u/pcwortex)\
**Post date:** [25 February 2024 22:13 UTC](https://discourse.nodered.org/t/data-from-one-function-to-another-function/85830/5 "2024-02-25T22:13:19Z")

</div>

Look I solved problem I am using join 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:** [26 March 2024 22:13 UTC](https://discourse.nodered.org/t/data-from-one-function-to-another-function/85830/6 "2024-03-26T22:13:47Z")

</div>

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