# MT-CONNECT, e.Variables

**URL:** <https://discourse.nodered.org/t/mt-connect-e-variables/36568>\
**Category:** General\
**Created:** [26 November 2020 15:36 UTC](https://discourse.nodered.org/t/mt-connect-e-variables/36568 "2020-11-26T15:36:10Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mattia.88](https://avatars.discourse-cdn.com/v4/letter/m/898d66/32.png) [@Mattia.88](https://discourse.nodered.org/u/Mattia.88)\
**Post date:** [26 November 2020 15:36 UTC](https://discourse.nodered.org/t/mt-connect-e-variables/36568/1 "2020-11-26T15:36:10Z")

</div>

Good morning everybody,  
i need to read this from "mt-connect":

msg.payload.MTConnectStreams.Streams[0].DeviceStream[0].ComponentStream[3].Events[0].e.Variables[0]\_

but the string "e:Variables" write in this mode is not correct. Which is the correct syntax?

Help me.

thanks

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 November 2020 16:08 UTC](https://discourse.nodered.org/t/mt-connect-e-variables/36568/2 "2020-11-26T16:08:15Z")

</div>

There’s a great page in the docs that will explain how to use the debug panel to find the right path to any data item.

> **[Working with messages : Node-RED](https://nodered.org/docs/user-guide/messages)**

---

<div class="post-metadata">

**Author:** ![Mattia.88](https://avatars.discourse-cdn.com/v4/letter/m/898d66/32.png) [@Mattia.88](https://discourse.nodered.org/u/Mattia.88)\
**Post date:** [26 November 2020 16:20 UTC](https://discourse.nodered.org/t/mt-connect-e-variables/36568/3 "2020-11-26T16:20:04Z")

</div>

> [@Mattia.88](#):
>
> e:Variables"

"e:variables" is correct. I need only know how to write this into "edit function node".

For example:

msg.payload.MTConnectStreams.Streams[0].DeviceStream[0].ComponentStream[3].Events[0].+"e:Variables"+[0].\_

This mode make an error.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 November 2020 16:37 UTC](https://discourse.nodered.org/t/mt-connect-e-variables/36568/4 "2020-11-26T16:37:25Z")

</div>

Easy answer - Open the [link](https://nodered.org/docs/user-guide/messages) i posted - it shows you how to get the path to any variable

Harder answer - Learn about [JavaScript Bracket notation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_accessors).

---

<div class="post-metadata">

**Author:** ![Mattia.88](https://avatars.discourse-cdn.com/v4/letter/m/898d66/32.png) [@Mattia.88](https://discourse.nodered.org/u/Mattia.88)\
**Post date:** [27 November 2020 08:30 UTC](https://discourse.nodered.org/t/mt-connect-e-variables/36568/5 "2020-11-27T08:30:39Z")

</div>

![Cattura](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/b/fb17882e2d2c3abf9e8e3b3d294daebb6e967e8b.png)

I tried to write this:

msg.payload.MTConnectStreams.Streams[0].DeviceStream[0].ComponentStream[3].[Events][0].["e:Variables"][0].\_;

but is not correct!

---

<div class="post-metadata">

**Author:** ![Mattia.88](https://avatars.discourse-cdn.com/v4/letter/m/898d66/32.png) [@Mattia.88](https://discourse.nodered.org/u/Mattia.88)\
**Post date:** [27 November 2020 08:31 UTC](https://discourse.nodered.org/t/mt-connect-e-variables/36568/6 "2020-11-27T08:31:34Z")

</div>

another possible solution?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [27 November 2020 08:46 UTC](https://discourse.nodered.org/t/mt-connect-e-variables/36568/7 "2020-11-27T08:46:26Z")

</div>

> [@Mattia.88](#):
>
> but is not correct!

The screenshot doesnt match the path because that is an error object. Something you are doing is throwing an error. Show us the debug (expanded) of the REAL message that you are trying to get this "e:Variables" from.

Something like this...  
 ![2020-11-27_08-42-51](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/a/ca93f4072a7cc0543973a2aa246aebcc7cf97e10.gif)

did you copy that path like the documentation shows?

---

<div class="post-metadata">

**Author:** ![Mattia.88](https://avatars.discourse-cdn.com/v4/letter/m/898d66/32.png) [@Mattia.88](https://discourse.nodered.org/u/Mattia.88)\
**Post date:** [27 November 2020 09:02 UTC](https://discourse.nodered.org/t/mt-connect-e-variables/36568/8 "2020-11-27T09:02:10Z")

</div>

[data.json](https://discourse.nodered.org/uploads/short-url/rHd3w8ZsgqR0T0qh5Mn12ByR4wX.json) (11.4 KB)

sorry ,the complete path is this

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [27 November 2020 09:10 UTC](https://discourse.nodered.org/t/mt-connect-e-variables/36568/9 "2020-11-27T09:10:06Z")

</div>

Ok - and?

You still get the item path like I have explained...

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/7/a72659bb0e637dfcf22889bcff50210cff801653.png)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/3/634f9a30f28af1d63ada1b5a5c68b907ce5d8e32.png)

---

<div class="post-metadata">

**Author:** ![Mattia.88](https://avatars.discourse-cdn.com/v4/letter/m/898d66/32.png) [@Mattia.88](https://discourse.nodered.org/u/Mattia.88)\
**Post date:** [27 November 2020 09:14 UTC](https://discourse.nodered.org/t/mt-connect-e-variables/36568/10 "2020-11-27T09:14:04Z")

</div>

> [@Steve-Mcl](#):
>
> You still get the item path like I have explained...

["e:Variables"][0].\_

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [27 November 2020 09:18 UTC](https://discourse.nodered.org/t/mt-connect-e-variables/36568/11 "2020-11-27T09:18:51Z")

</div>

> [@Mattia.88](#):
>
> > [@Steve-Mcl](#):
> >
> > You still get the item path like I have explained...
> 
> ["e:Variables"][0].\_

????????????

What are you saying?

ok, so to save us both some time - here is the answer....

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/6/b64e3b88872d9ca54e6afb48d653d6998d19ffac.png)

I can not properly help you if you do not read the information I provide or if you dont answer the questions.

---

<div class="post-metadata">

**Author:** ![Mattia.88](https://avatars.discourse-cdn.com/v4/letter/m/898d66/32.png) [@Mattia.88](https://discourse.nodered.org/u/Mattia.88)\
**Post date:** [27 November 2020 09:22 UTC](https://discourse.nodered.org/t/mt-connect-e-variables/36568/12 "2020-11-27T09:22:00Z")

</div>

I resolved the problem whih this:

msg.payload.MTConnectStreams.Streams[0].DeviceStream[0].ComponentStream[3].Events[0]["e:Variables"][0].\_

Sorry, but i started work with node-red from only 3 month.

thanks

thanks

---

<div class="post-metadata">

**Author:** ![Mattia.88](https://avatars.discourse-cdn.com/v4/letter/m/898d66/32.png) [@Mattia.88](https://discourse.nodered.org/u/Mattia.88)\
**Post date:** [27 November 2020 09:22 UTC](https://discourse.nodered.org/t/mt-connect-e-variables/36568/13 "2020-11-27T09:22:38Z")

</div>

I resolved the problem with this:

msg.payload.MTConnectStreams.Streams[0].DeviceStream[0].ComponentStream[3].Events[0]["e:Variables"][0].\_

Sorry, but i started work with node-red from only 3 month.

thanks

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 November 2020 10:12 UTC](https://discourse.nodered.org/t/mt-connect-e-variables/36568/14 "2020-11-27T10:12:44Z")

</div>

> [@Mattia.88](#):
>
> Sorry, but i started work with node-red from only 3 month

That is why it has been suggested numerous times that you read the Working with Messages page and in particular learn how to get the path to a variable by clicking the appropriate button in debug pane, from where you can paste it directly into your function.

---

<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 January 2021 10:12 UTC](https://discourse.nodered.org/t/mt-connect-e-variables/36568/15 "2021-01-26T10:12:50Z")

</div>

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