# Allen Bradley PLC variable

**URL:** <https://discourse.nodered.org/t/allen-bradley-plc-variable/36576>\
**Category:** Industrial\
**Created:** [26 November 2020 17:22 UTC](https://discourse.nodered.org/t/allen-bradley-plc-variable/36576 "2020-11-26T17:22:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChrisWeb71](https://avatars.discourse-cdn.com/v4/letter/c/53a042/32.png) [@ChrisWeb71](https://discourse.nodered.org/u/ChrisWeb71)\
**Post date:** [26 November 2020 17:22 UTC](https://discourse.nodered.org/t/allen-bradley-plc-variable/36576/1 "2020-11-26T17:22:01Z")

</div>

Hello,  
I have the following problem I get values from an Allen Bradley PLC.  
If I want to use several variables in one function at the same time, it usually works like this:  
this is output:  
msg.payload = 22  
msg.topic = 'value1'  
if I now want to process the value in a function I do that by doing the following:

var test = msg.payload.value1

But a day at Allen Bradley looks like this e.g.  
Local: 4: I.Ch0Data -\> that is the topic

How can I achieve this?  
If I do the following:  
var test = msg.payload.Local: 4: I.Ch0Data  
I get an error.

Is there a way that works?

---

<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 17:35 UTC](https://discourse.nodered.org/t/allen-bradley-plc-variable/36576/2 "2020-11-26T17:35:49Z")

</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:** ![ChrisWeb71](https://avatars.discourse-cdn.com/v4/letter/c/53a042/32.png) [@ChrisWeb71](https://discourse.nodered.org/u/ChrisWeb71)\
**Post date:** [27 November 2020 09:47 UTC](https://discourse.nodered.org/t/allen-bradley-plc-variable/36576/3 "2020-11-27T09:47:14Z")

</div>

Thanks for pointing this out, but I can't find a solution to my problem there.  
what do I have to do the node-red that puts together  
"msg.payload.Local: 4: I.Ch0Data"

---

<div class="post-metadata">

**Author:** ![machadotiago](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/machadotiago/32/23776_2.png) [@machadotiago](https://discourse.nodered.org/u/machadotiago)\
**Post date:** [3 December 2020 15:20 UTC](https://discourse.nodered.org/t/allen-bradley-plc-variable/36576/4 "2020-12-03T15:20:54Z")

</div>

> [@ChrisWeb71](#):
>
> t a day at Allen Bradley looks like this e.g.  
> Local: 4: I.Ch0Data -\> that is the topic
> 
> How can I achieve this?  
> If I do the follow

Have you tried the " Change" node?

---

<div class="post-metadata">

**Author:** ![ChrisWeb71](https://avatars.discourse-cdn.com/v4/letter/c/53a042/32.png) [@ChrisWeb71](https://discourse.nodered.org/u/ChrisWeb71)\
**Post date:** [3 December 2020 18:07 UTC](https://discourse.nodered.org/t/allen-bradley-plc-variable/36576/5 "2020-12-03T18:07:26Z")

</div>

What do you mean by that

---

<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:** [3 December 2020 20:42 UTC](https://discourse.nodered.org/t/allen-bradley-plc-variable/36576/6 "2020-12-03T20:42:59Z")

</div>

I assume he meant that you can use a Change node to do what you want. However I am not clear exactly what data you have to start with. Can you feed the message you have into a Debug node set to show Complete Message and show us what it shows please. Then tell us for that example exactly what you want to see in msg.payload (assuming that is where you want it).

---

<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:** [1 February 2021 20:42 UTC](https://discourse.nodered.org/t/allen-bradley-plc-variable/36576/7 "2021-02-01T20:42:59Z")

</div>

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