Class GetSchemaResponse
GetSchemaResponse
스크립트 프로젝트의 getSchema()
응답을 만드는 빌더입니다.
function getSchema() {
const cc = DataStudioApp.createCommunityConnector();
const fields = cc.getFields();
fields.newDimension()
.setId('Created')
.setName('Date Created')
.setDescription('The date that this was created')
.setType(cc.FieldType.YEAR_MONTH_DAY);
fields.newMetric()
.setId('Amount')
.setName('Amount (USD)')
.setDescription('The cost in US dollars')
.setType(cc.FieldType.CURRENCY_USD);
return cc.newGetSchemaResponse().setFields(fields).build();
}
자세한 문서
printJson()
이 객체의 JSON 표현을 출력합니다. 디버깅 전용입니다.
리턴
String
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2024-12-22(UTC)
[null,null,["최종 업데이트: 2024-12-22(UTC)"],[[["`getSchemaResponse` facilitates the creation of a schema for your Data Studio Community Connector, defining the structure of data your connector provides."],["It allows you to specify dimensions and metrics, including their data types, descriptions, and IDs, using the `fields` object."],["The `build()` method finalizes the schema definition and returns a validated object in the format required by Data Studio."],["Additional methods like `printJson()` and `setFields()` are available for debugging and further schema customization."]]],["The `getSchema()` function defines data fields for a script project using the `DataStudioApp` service. It creates a dimension field named \"Date Created\" of `YEAR_MONTH_DAY` type and a metric field \"Amount (USD)\" of `CURRENCY_USD` type. The `newGetSchemaResponse()` builder then compiles and validates these fields using `setFields()` before the final format for Data Studio is produced using `build()`. `printJson()` outputs a JSON representation for debugging.\n"]]