# Change of variable name

**URL:** https://discourse.nodered.org/t/change-of-variable-name/82654
**Category:** General
**Tags:** function-node
**Created:** [6 November 2023 14:49 UTC](https://discourse.nodered.org/t/change-of-variable-name/82654 "2023-11-06T14:49:16Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Wolfe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/wolfe/32/108255_2.png) [@Wolfe](https://discourse.nodered.org/u/Wolfe)
#### Post date: [6 November 2023 14:49 UTC](https://discourse.nodered.org/t/change-of-variable-name/82654/1 "2023-11-06T14:49:17Z")

</div>

I got stucked!

I use a TopicJson payload:  
{"220":"0","XXX":"255","SOC":"98.8","SOH":"82","B-T":"18.14","M-T":"23","Tun":"","kWh":"4.9","Amp":"-0","RPM":"470","Nm ":"-1","FW ":"","C01":"4.11","C02":"4.11","C03":"4.11","C04":"4.11","C05":"4.11","C06":"4.11","C07":"4.12","C08":"4.11","C09":"4.11","C10":"4.11","C11":"4.11","C12":"4.11","C13":"4.11","C14":"4.11","Pac":"57.6","T01":"19","T02":"18","T03":"18","T04":"18","T05":"18","T06":"18"," **T07**":" **18**","Reg":"","ECO":"","Nor":"","CSt":"0","tAY":"0.00","B12":"13.88","PN1":"1","PN2":"0","KmT":"410666","KmR":"57","KmH":"5.1","SeT":"14","tKT":"282","tKR":"51","tTM":"3298","tKW":"2.7","t10":"9.5","t01":"0.09","tMN":"0.05","tKH":"30.7","kW ":"-0.02","CEt":"","CdK":""," **C-T**":"40","CKw":"","Min":" 30","T-T":"19.86","Acc":"0.63","AnX":"-2.53","AnY":"-3.78","AnZ":"-36.44"}  
where I easily can extract values, like: T07  
Node 'Function':  
var Inhalt = msg.payload  
node.log(typeof Inhalt)  
msg.payload = Inhalt.T07  
msg.payload = Number(msg.payload)  
msg.topic = "BattT07"  
return msg;  
Result = 18

but if the varialbe name is: C-T , I'm in trouble:  
 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/e/6e8f753ce0f7afb13c25eac9e4ee05cf6f26cc4c.png)

In line 3 a red tile is below T, thus the functions "thinks" T must be deducted from "Inhalt.C" \<- which is wrong !

The varaible name is "T-C".

Does someone has an "easy" solution / fix ?

Thanks in advance

---

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [6 November 2023 14:57 UTC](https://discourse.nodered.org/t/change-of-variable-name/82654/2 "2023-11-06T14:57:47Z")

</div>

Try Inhalt["T-C"]

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [6 November 2023 14:58 UTC](https://discourse.nodered.org/t/change-of-variable-name/82654/3 "2023-11-06T14:58:54Z")

</div>

An easy way to find this is send the msg.payload to a debug node. Then you can look at the data and see to the side how you can copy the path to it. In this case it would show `payload["C-T"]` so you would want to call it `Inhalt["C-T"]`

There’s a great page in the docs ([Working with messages : Node-RED](https://nodered.org/docs/user-guide/messages)) that will explain how to use the debug panel to find the right path to any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

![BX00Cy7yHi](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/d/bd1f333a9e043b061b39917c328b0094d3e52d30.gif)

In addition it is nice to provide the actual code instead of an image of it.

---

<div class="post-metadata">

### Author: ![Wolfe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/wolfe/32/108255_2.png) [@Wolfe](https://discourse.nodered.org/u/Wolfe)
#### Post date: [6 November 2023 16:30 UTC](https://discourse.nodered.org/t/change-of-variable-name/82654/4 "2023-11-06T16:30:46Z")

</div>

Thanks and thanks to jbudd, too.

Change done, w/o red triangle 👌

I'll check out for functioning next time Twizy is connected for charging. 👍

@zenofmud: I pasted the picture to see easily the "red tile".

---

<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: [20 November 2023 16:31 UTC](https://discourse.nodered.org/t/change-of-variable-name/82654/5 "2023-11-20T16:31:16Z")

</div>

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