# Help with switching msg.payload based on serial buffer input

**URL:** <https://discourse.nodered.org/t/help-with-switching-msg-payload-based-on-serial-buffer-input/75012>\
**Category:** General\
**Tags:** function-node\
**Created:** [10 February 2023 20:35 UTC](https://discourse.nodered.org/t/help-with-switching-msg-payload-based-on-serial-buffer-input/75012 "2023-02-10T20:35:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mzychowicz](https://avatars.discourse-cdn.com/v4/letter/m/7ab992/32.png) [@mzychowicz](https://discourse.nodered.org/u/mzychowicz)\
**Post date:** [10 February 2023 20:35 UTC](https://discourse.nodered.org/t/help-with-switching-msg-payload-based-on-serial-buffer-input/75012/1 "2023-02-10T20:35:01Z")

</div>

I am currently simulating devices via node red for codesys and receiving serial buffers. I would like to change the msg.payload based on the different buffer inputs. I am having trouble with the syntax. Please see the photos for a better understanding.

 ![pl1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/c/1c6043fe33af7321228e48a31fab83477a8ab8f3.png)  
 ![pl2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/1/e1778d59fb283751a029da589f41e502b8e1cb0f.png)

---

<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:** [11 April 2023 20:35 UTC](https://discourse.nodered.org/t/help-with-switching-msg-payload-based-on-serial-buffer-input/75012/2 "2023-04-11T20:35:55Z")

</div>

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