How to set a switch default value to the first index, not knowing the actual values

Hello,

Which expression should I use in order to set a switch default value to the first index, no matter what values the switch is currently holding ? I don’t really care if the values are not sorted, I just need one to be selected.

In my case I can’t know the key and value in advance but the switch is never empty since its values are set by an external script which rewrites the .json file.

You can set the switch’s default property as follows:

JS{{
return Object.values(@{this.values})[0]
}}

Note that the default property is only applied when loading the json file.

1 Like

Merci beaucoup pour la réponse super rapide !