Reads a select or radio group's saved value as the number of the choice, applying a fallback when
it is unset or is not a choice.
Clay stores a select's value as the option's text, and the watch's reply writes a choice back as
text too, so a saved choice is far more often "3" than 3. Both read as 3. A whole number from
0 up and text holding only digits count, as they do on the watch.
It also takes what the watch never receives. A toggle saved under the same key leaves true or
false on the phone, or the words "true" and "false", and each reads as 1 or 0. Anything
else, such as another word, a negative, or a fraction, gives the fallback.
Parameters
value: any
The raw Clay value, which may already be unwrapped or still wrapped.
fallback: number
What to return when the value is missing or is not a choice.
Reads a select or radio group's saved value as the number of the choice, applying a fallback when it is unset or is not a choice.
Clay stores a select's value as the option's text, and the watch's reply writes a choice back as text too, so a saved choice is far more often
"3"than3. Both read as 3. A whole number from 0 up and text holding only digits count, as they do on the watch.It also takes what the watch never receives. A toggle saved under the same key leaves
trueorfalseon the phone, or the words"true"and"false", and each reads as 1 or 0. Anything else, such as another word, a negative, or a fraction, gives the fallback.