How to replace number by variable in payload[6]

I want to select various part of a list using global variable.
I have a global variable named 'Cue'
How can I replace the 6 in Payload[6] by the value of Cue?
I have tried a function node with:

var count = global.get('Cue');
msg.payload = msg.payload + "[" + count + "]";
return msg;

But it doesn't work…
Thank you in advance for your help,

var count = global.get('Cue');
msg.payload = msg.payload[count];
return msg;

... should do it! :+1:

1 Like

Thank you, it works !

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