Class OptionBuilder
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
옵션빌더
SelectSingle
및 SelectMultiple
의 옵션을 만드는 빌더입니다.
const cc = DataStudioApp.createCommunityConnector();
const config = cc.getConfig();
const option1 =
config.newOptionBuilder().setLabel('option label').setValue('option_value');
const option2 = config.newOptionBuilder()
.setLabel('second option label')
.setValue('option_value_2');
const info1 = config.newSelectSingle()
.setId('api_endpoint')
.setName('Data Type')
.setHelpText('Select the data type you\'re interested in.')
.addOption(option1)
.addOption(option2);
자세한 문서
setLabel(label)
이 옵션 빌더의 라벨을 설정합니다. 라벨은 사용자가 드롭다운에서 하나 이상의 옵션을 선택할 때 표시되는 텍스트입니다.
매개변수
이름 | 유형 | 설명 |
label | String | 설정할 라벨입니다. |
리턴
OptionBuilder
: 체이닝을 위한 이 빌더
setValue(value)
이 옵션 빌더의 값을 설정합니다. 값은 사용자가 드롭다운에서 하나 이상의 옵션을 선택할 때 코드에 전달되는 값입니다.
매개변수
이름 | 유형 | 설명 |
value | String | 설정할 값입니다. |
리턴
OptionBuilder
: 체이닝을 위한 이 빌더
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-26(UTC)
[null,null,["최종 업데이트: 2025-07-26(UTC)"],[[["\u003cp\u003e\u003ccode\u003eOptionBuilder\u003c/code\u003e facilitates the creation of options for \u003ccode\u003eSelectSingle\u003c/code\u003e and \u003ccode\u003eSelectMultiple\u003c/code\u003e elements in Data Studio.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods like \u003ccode\u003esetLabel\u003c/code\u003e and \u003ccode\u003esetValue\u003c/code\u003e to define the display text and underlying value of each option.\u003c/p\u003e\n"],["\u003cp\u003eThese options are then added to \u003ccode\u003eSelectSingle\u003c/code\u003e or \u003ccode\u003eSelectMultiple\u003c/code\u003e components for user interaction within a Data Studio connector.\u003c/p\u003e\n"],["\u003cp\u003eUsing \u003ccode\u003eOptionBuilder\u003c/code\u003e simplifies the process of creating interactive dropdown menus in your custom connectors.\u003c/p\u003e\n"]]],[],null,["# Class OptionBuilder\n\nOptionBuilder\n\nA builder for creating options for [SelectSingle](/apps-script/reference/data-studio/select-single)s and [SelectMultiple](/apps-script/reference/data-studio/select-multiple)s.\n\n```javascript\nconst cc = DataStudioApp.createCommunityConnector();\nconst config = cc.getConfig();\n\nconst option1 =\n config.newOptionBuilder().setLabel('option label').setValue('option_value');\n\nconst option2 = config.newOptionBuilder()\n .setLabel('second option label')\n .setValue('option_value_2');\n\nconst info1 = config.newSelectSingle()\n .setId('api_endpoint')\n .setName('Data Type')\n .setHelpText('Select the data type you\\'re interested in.')\n .addOption(option1)\n .addOption(option2);\n``` \n\n### Methods\n\n| Method | Return type | Brief description |\n|--------------------------------------|--------------------|----------------------------------------|\n| [setLabel(label)](#setLabel(String)) | [OptionBuilder](#) | Sets the label of this option builder. |\n| [setValue(value)](#setValue(String)) | [OptionBuilder](#) | Sets the value of this option builder. |\n\nDetailed documentation\n----------------------\n\n### `set``Label(label)`\n\nSets the label of this option builder. Labels are the text that the user sees when selecting\none or more options from the dropdown.\n\n#### Parameters\n\n| Name | Type | Description |\n|---------|----------|-------------------|\n| `label` | `String` | The label to set. |\n\n#### Return\n\n\n[OptionBuilder](#) --- This builder, for chaining.\n\n*** ** * ** ***\n\n### `set``Value(value)`\n\nSets the value of this option builder. Values are what is passed to the code when a user\nselects one or more options from the dropdown.\n\n#### Parameters\n\n| Name | Type | Description |\n|---------|----------|-------------------|\n| `value` | `String` | The value to set. |\n\n#### Return\n\n\n[OptionBuilder](#) --- This builder, for chaining."]]