Builder to create a getSchema() response for your script project.
functiongetSchema(){constcc=DataStudioApp.createCommunityConnector();constfields=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);returncc.newGetSchemaResponse().setFields(fields).build();}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-02 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"]]