Trigger a message payload based on input from parallel port

Hmmm. I suspect with the lack of screen shots or exported flow, we are misunderstanding each other.

Try this...

  1. Add debug node before and after the function node
    1. SET the DEBUG nodes to output 'complete msg'
  2. Replace the function node code with below.
  3. In the debug window, expand the resulting msg objects
  4. Take Screenshots and post here.
    1. Include the debug window
    2. Include an image showing (at minimum) the region of interest of your flow

Why..
We need to see all properties of the msg so we can see why it gets past the case statements. So in the debug window we should see what is in msg.alphaNumeric.
I would bet my left nut and several packet of my favorite crisps that the value in msg.alphaNumeric IS NOT a match to any of the case entries you have.

//remove all non alphanumeric (and the @) from the input 
//NOTE: store it in msg object so we can inspect it in the debug window
msg.alphaNumeric = msg.payload.replace(/[^a-z0-9@+]+/gi, ''); 
//use switch to populate msg.output based on content of alphaNumeric
switch (msg.alphaNumeric) {
  case "@1T@1XR@1Y10":
  msg.output = "1";
  break;
  case "@1T@1XR@1Y236":
  msg.output = "2";
  break;
  default:
  node.error(`UNKNOWN value in payload '${msg.payload}'. Cannot generate value for msg.output`, msg);
  return null;//halt flow of msg - dont trigger output of this node
}
return msg;//return msg so next node




Lastly, if you want further help, it may be beneficial if you post your flow and sample data. How to share code or flow json