How do I use payload data sent through MQTT to be used for checking if else statement (node.js)

This is what I’m sending to TagoIO through MQTT,
image

And lines 14-18 is the part of my script I’m having trouble with,
image

I’m trying to create the if else statement to change the array(pee) according to the value of the variable(feedback) that is being input and whenever I publish the payload from MQTT, this is what I get in live inspector,

I know that I’m writing lines 14-18 wrongly but I do not know the solution.
Any help no matter how small would be greatly appreciated, ty.

Hi smartxholding,

Firstly I would only recommend you to paste the code here and don’t use a image, is way faster to get access to your code.

To help you with your problem, I would recommend you to get the scope property in your analysis async function. There you can check out the data you are receiving. Try console logging your scope and check if you’re receiving the correct data inside your function. As I couldn’t copy your code, try to adapt this one into your code.

   const { Analysis, Services } = require("@tago-io/sdk");

async function myAnalysis(context, scope) {

  const environment = Utils.envToJson(context.environment); 
  if (!environment) {
    return;
  }

  const feedback = scope.find((x) => x.variable === "feedback") || scope[0];
  if (!myData) {
    return context.log("Couldn't find any variable in the scope.");
  }
  console.log(feedback);
}

module.exports = new Analysis(myAnalysis);

Thank you!
Guilherme Oliveira