Matrix of Clones - Assign variables to clones with JavaScript

Hi, how can I assign variables to clones in a matrix in the props field using JavaScript?
What I mean exactly is:
My matrix has a variable called channel_number.
Each clone inside the matrix should get it's own channel_number variable, starting with the one from the matrix, and then +1 for each clone.
I'll do the +1 part later, but for now I can't figure out how to give clones unique variables.

This is what my code looks like right now. Does anyone know the solution?

JS{{
var props = {}
props.widgetId = "channelstrip_0" // selecting the panel to be cloned
props.variables.channel_number = 1 // channel_number is a variable of the panel
return props
}}

You're almost there !

JS{
var props = {}
// clone properties
props.widgetId = "channelstrip_0" // selecting the panel to be cloned
// clone props property (override cloned widget properties)
props.props = {}
props.props.variables = {
 channel_number:  1 + $ // $ = index
}

return props

}
2 Likes

amazing, it works! thanks for the quick reply :slight_smile: