Suggest choices
Use choices to provide the editor a list of values to choose from. When choices are provided, the editor becomes a combo box. Choices can be either a fixed list, or a function that returns a list.
A choice provider is a function with no parameters that returns a list of strings.
The following example demonstrates two ways of defining choices:
- Result
- Register choices
- Use choices
Run this code once
grok.functions.register({
signature: 'List<String> jsVeggies()',
run: () => ["Cucumber", "Cauliflower"]});
https://public.datagrok.ai/scripts
#input: string fruit {choices: ["apple", "banana"]}
#input: string vegetable {choices: jsveggies}