# Function msg.payload x1

**URL:** <https://discourse.nodered.org/t/function-msg-payload-x1/40174>\
**Category:** General\
**Created:** [1 February 2021 14:44 UTC](https://discourse.nodered.org/t/function-msg-payload-x1/40174 "2021-02-01T14:44:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hannoverRed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hannoverred/32/36335_2.png) [@hannoverRed](https://discourse.nodered.org/u/hannoverRed)\
**Post date:** [1 February 2021 14:44 UTC](https://discourse.nodered.org/t/function-msg-payload-x1/40174/1 "2021-02-01T14:44:46Z")

</div>

Hallo, ich möchte gerne bei msg.warnings[2].regionName die 2 variable ersetzten mit mag.payload.  
Beispiel:

```auto
var x1 = msg.payload;
msg.warnings[x1].regionName

```

x1 würd sich regelmäßig ändern und soll deswegen variable über das payload einsetzt werden, leider bekomme ich das nicht hin. kann mir da wer helfen?

Aktuell:  
` msg.payload = msg.warnings[2].regionName +"\n"+ msg.warnings[2].time +"\n"+ msg.warnings[2].headline +"\n"+ msg.warnings[2].description;`

Soll:

````auto
var x1 = msg.payload;
msg.payload = msg.warnings[x1].regionName +"\n"+ msg.warnings[x1].time +"\n"+ msg.warnings[x1].headline +"\n"+ msg.warnings[x1].description; ```
````

---

<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:** [2 April 2021 14:45 UTC](https://discourse.nodered.org/t/function-msg-payload-x1/40174/2 "2021-04-02T14:45:16Z")

</div>

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