Class OptionBuilder Stay organized with collections Save and categorize content based on your preferences.
Page Summary
OptionBuilder is used to create options for SelectSingle and SelectMultiple objects.
The
setLabel()method sets the text that the user sees for an option.The
setValue()method sets the value that is passed to the code when an option is selected.
A builder for creating options forSelects andSelects.
constcc=DataStudioApp.createCommunityConnector();constconfig=cc.getConfig();constoption1=config.newOptionBuilder().setLabel('option label').setValue('option_value');constoption2=config.newOptionBuilder().setLabel('second option label').setValue('option_value_2');constinfo1=config.newSelectSingle().setId('api_endpoint').setName('Data Type').setHelpText('Select the data type you\'re interested in.').addOption(option1).addOption(option2);
Methods
| Method | Return type | Brief description |
|---|---|---|
set | Option | Sets the label of this option builder. |
set | Option | Sets the value of this option builder. |
Detailed documentation
setLabel(label)
Sets the label of this option builder. Labels are the text that the user sees when selectingone or more options from the dropdown.
Parameters
| Name | Type | Description |
|---|---|---|
label | String | The label to set. |
Return
Option — This builder, for chaining.
setValue(value)
Sets the value of this option builder. Values are what is passed to the code when a userselects one or more options from the dropdown.
Parameters
| Name | Type | Description |
|---|---|---|
value | String | The value to set. |
Return
Option — This builder, for chaining.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-11 UTC.