Set in script property

Hi, i tried to use the set property in a switch widget, but it does not work:

The current situation:
in a modal i have to switches , one switch represents the main category, the second shows the result of the main selection.
Switch1 = Main Category
Switch2 = the results

Switch2 values property is set via OSC{...} receive
Now instead of sending every time the whole object via OSC{...} when the Main Category changes, i would like to trigger this by Switch1 script property:

if (value === 'all') {
return; // when all is selected everything should be shown
}
var tempObj = {};
Object.keys(getProp("Switch2","values")).forEach(function(key) {
if (key.includes('#' + value)={
tempObj[key] = getProp("Switch2","values")[key]; //add only the needed key and value pairs
}
})
set("Switch2",tempObj);

I don't understand why i can't update the values property of Switch2, i did the exact same thing via custom module.

Thanks!

You're mixing up the widget's value and its property called "values", these are not the same and only the first one can be changed using set().

Thanks! I will then use OSC{..}

You could however use a variable widget to hold that value, change it with set(), and retreive it with the @{} syntax.