I'm currently using this in the props of a matrix:
{
"widgetId": "track_strip",
"props": {
"variables": {
"n": #{$+1}
},
"visible": true
}
}
This setup works fine, with the n
values being incremented by one for each clone. However, I would like the n
value for each clone to be determined by the corresponding value from another widget. For example, if the other widget provides [1, 3, 4, 5]
, each clone should take these values respectively for n
.
I can't figure out how to achieve this. Any help would be greatly appreciated!
Instead of #{$ + 1}
:
JS{
var values = @{other_widget_id} || [] // assuming that widget holds the array in its value
return values[$]
}
It works great, thank you!
However, when I try something similar in the "value" of a multixy widget:
JS{
var values = @{patch_multi_result_track_index} || []; // assuming that widget holds the array in its value
var result = values.flatMap(value => [
`OSC{/track/${value}/x}`,
`OSC{/track/${value}/y}`
]);
return `[${result.join(', ')}]`;
}
I always get this as the computed property: [__VARS.undefined, __VARS.undefined, __VARS.undefined, __VARS.undefined]
The OSC{} syntax cannot be composed programmatically, this can't work this way. You might need to write a custom module to handle all this properly.