Class OptionBuilder

  • OptionBuilder facilitates the creation of options for SelectSingle and SelectMultiple elements in Data Studio.

  • It provides methods like setLabel and setValue to define the display text and underlying value of each option.

  • These options are then added to SelectSingle or SelectMultiple components for user interaction within a Data Studio connector.

  • Using OptionBuilder simplifies the process of creating interactive dropdown menus in your custom connectors.

OptionBuilder

A builder for creating options for SelectSingle s and SelectMultiple s.

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

MethodReturn typeBrief description
setLabel(label) OptionBuilder Sets the label of this option builder.
setValue(value) OptionBuilder 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 selecting one or more options from the dropdown.

Parameters

NameTypeDescription
labelStringThe label to set.

Return

OptionBuilder — This builder, for chaining.


setValue(value)

Sets the value of this option builder. Values are what is passed to the code when a user selects one or more options from the dropdown.

Parameters

NameTypeDescription
valueStringThe value to set.

Return

OptionBuilder — This builder, for chaining.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024年12月02日 UTC.