Payload variable in function

function-node
#1

I’m trying to use payload variable payload.data.[01_Status]
as below, but it doesn;t like the square brackets.
I have tried without them but it doesn’t like that either.

payload.data.state_bits = intToUint(payload.data.[01_Status],16).toString(2).split("").join("");

0 Likes

#2

Is 01_Status a variable? If not, that should be referenced like this:

payload.data["01_Status"]

The dot before the brackets is only required in the templates. In the function node, you follow Javascript Rules.

0 Likes

#3

That was it, thanks. I forgot about that.
I got the variable by copying the path in the debug screen and it didn’t contain the quotations inside.

0 Likes