Class Fields
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
ক্ষেত্র একটি সম্প্রদায় সংযোগকারীর জন্য Field
একটি সেট রয়েছে৷ ক্ষেত্রগুলির এই সেটটি নির্ধারণ করে যে ডেটা স্টুডিওতে কোন মাত্রা এবং মেট্রিক্স ব্যবহার করা যেতে পারে।
const cc = DataStudioApp.createCommunityConnector();
const fields = cc.getFields();
const field1 = fields
.newDimension()
// Set other properties as needed.
.setId('field1_id');
বিস্তারিত ডকুমেন্টেশন
as Array()
একটি অ্যারে হিসাবে এই বস্তুর একটি দৃশ্য প্রদান করে।
const fields = DataStudioApp.createCommunityConnector().getFields();
fields.newDimension().setId('field1_id');
fields.newDimension().setId('field2_id');
fields.newDimension().setId('field3_id');
// Logging the ID of each field:
fields.asArray().map((field) => {
Logger.log(field.getId());
});
প্রত্যাবর্তন
Field[]
— Field
বস্তুর একটি অ্যারে।
build()
এই বস্তুটিকে যাচাই করে এবং ডেটা স্টুডিওর প্রয়োজনীয় বিন্যাসে এটি ফেরত দেয়।
প্রত্যাবর্তন
Object[]
— বৈধ ফিল্ড ডেটা, অবজেক্টের তালিকা হিসাবে উপস্থাপিত।
নিক্ষেপ করে
Error
— যদি একটি বৈধ বস্তু নির্মাণ করা না যায়।
for Ids(ids)
Field
s-এ ফিল্টার করা একটি নতুন Fields
অবজেক্টকে ids
একটি আইডি দিয়ে ফেরত দেয়।
const fields = DataStudioApp.createCommunityConnector().getFields();
fields.newDimension().setId('field1_id');
fields.newDimension().setId('field2_id');
fields.newDimension().setId('field3_id');
// subsetFields is a Fields object that only contains field1 and field2.
const subsetFields = fields.forIds(['field1_id', 'field3_id']);
পরামিতি
নাম | টাইপ | বর্ণনা |
---|
ids | String[] | যে ক্ষেত্রের আইডি রাখতে হবে। |
প্রত্যাবর্তন
Fields
- একটি নতুন Fields
অবজেক্ট।
get Default Dimension()
ক্ষেত্রগুলির সেটের জন্য ব্যবহৃত ডিফল্ট মাত্রা প্রদান করে। একটি নতুন ভিজ্যুয়ালাইজেশন তৈরি হলে ডিফল্ট মাত্রা স্বয়ংক্রিয়ভাবে নির্বাচন করা হয়।
প্রত্যাবর্তন
Field
— যে মাত্রা ডিফল্ট মাত্রা হিসাবে সেট করা হয়, অথবা যদি কোনো ডিফল্ট মাত্রা সেট করা না থাকে তাহলে null
।
get Default Metric()
ক্ষেত্রগুলির সেটের জন্য ব্যবহৃত ডিফল্ট মেট্রিক প্রদান করে। একটি নতুন ভিজ্যুয়ালাইজেশন তৈরি হলে ডিফল্ট মেট্রিক স্বয়ংক্রিয়ভাবে নির্বাচন করা হয়।
প্রত্যাবর্তন
Field
— যে মেট্রিকটি ডিফল্ট মেট্রিক হিসাবে সেট করা হয়, অথবা যদি কোনও ডিফল্ট মেট্রিক সেট করা না থাকে তাহলে null
।
get Field By Id(fieldId)
একটি প্রদত্ত ID সহ একটি ক্ষেত্র ফেরত দেয়, অথবা যদি সেই ID সহ কোনো ক্ষেত্র এই Fields
অবজেক্টে না থাকে তাহলে null
।
const fields = DataStudioApp.createCommunityConnector().getFields();
const field1 = fields.newDimension().setId('field1_id');
// byId is the same as field1.
const byId = fields.getFieldById('field1_id');
// byId2 is null.
const byId2 = fields.getFieldById('not present id');
পরামিতি
নাম | টাইপ | বর্ণনা |
---|
field Id | String | ফিল্ডের আইডি পেতে হবে। |
প্রত্যাবর্তন
Field
— প্রদত্ত আইডি সহ Field
বা null
যদি এই Fields
অবজেক্টের মধ্যে এই জাতীয় কোনও ক্ষেত্র না থাকে।
new Dimension()
একটি নতুন মাত্রা Field
প্রদান করে।
প্রত্যাবর্তন
Field
- একটি নতুন মাত্রা Field
।
new Metric()
একটি নতুন মেট্রিক Field
প্রদান করে।
প্রত্যাবর্তন
Field
— একটি নতুন মেট্রিক Field
।
set Default Dimension(fieldId)
ক্ষেত্রগুলির সেটের জন্য ব্যবহৃত ডিফল্ট মাত্রা সেট করে। একটি নতুন ভিজ্যুয়ালাইজেশন তৈরি হলে ডিফল্ট মাত্রা স্বয়ংক্রিয়ভাবে নির্বাচন করা হয়।
পরামিতি
নাম | টাইপ | বর্ণনা |
---|
field Id | String | ডিফল্ট মাত্রা হিসাবে ব্যবহার করার জন্য ক্ষেত্রের ID। এই আইডিটি অবশ্যই ক্ষেত্রগুলির সেটে উপস্থিত থাকতে হবে। |
set Default Metric(fieldId)
ক্ষেত্রগুলির সেটের জন্য ব্যবহৃত ডিফল্ট মেট্রিক সেট করে। একটি নতুন ভিজ্যুয়ালাইজেশন তৈরি হলে ডিফল্ট মেট্রিক স্বয়ংক্রিয়ভাবে নির্বাচন করা হয়।
পরামিতি
নাম | টাইপ | বর্ণনা |
---|
field Id | String | ডিফল্ট মেট্রিক হিসাবে ব্যবহার করার জন্য ক্ষেত্রের ID। এই আইডিটি অবশ্যই ক্ষেত্রগুলির সেটে উপস্থিত থাকতে হবে। |
অন্য কিছু উল্লেখ না করা থাকলে, এই পৃষ্ঠার কন্টেন্ট Creative Commons Attribution 4.0 License-এর অধীনে এবং কোডের নমুনাগুলি Apache 2.0 License-এর অধীনে লাইসেন্স প্রাপ্ত। আরও জানতে, Google Developers সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-07-25 UTC-তে শেষবার আপডেট করা হয়েছে।
[null,null,["2025-07-25 UTC-তে শেষবার আপডেট করা হয়েছে।"],[[["\u003cp\u003eThe \u003ccode\u003eFields\u003c/code\u003e object in Apps Script allows you to define the dimensions and metrics available to your Data Studio Community Connector.\u003c/p\u003e\n"],["\u003cp\u003eYou can manipulate and manage these fields using methods provided by the \u003ccode\u003eFields\u003c/code\u003e object, such as creating new fields, setting defaults, and retrieving fields by ID.\u003c/p\u003e\n"],["\u003cp\u003eUsing \u003ccode\u003ebuild()\u003c/code\u003e, you can obtain the validated field data as a list of objects suitable for use in Data Studio.\u003c/p\u003e\n"],["\u003cp\u003eMethods like \u003ccode\u003egetDefaultDimension()\u003c/code\u003e and \u003ccode\u003esetDefaultDimension()\u003c/code\u003e allow you to control which dimension and metric are automatically selected when creating visualizations in Data Studio.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eforIds()\u003c/code\u003e enables you to filter and work with a subset of fields based on their IDs.\u003c/p\u003e\n"]]],["The core content defines `Fields` for Data Studio community connectors, specifying usable dimensions and metrics. Key actions include creating new dimensions/metrics with `newDimension()` and `newMetric()`, setting defaults via `setDefaultDimension()` and `setDefaultMetric()`, and retrieving fields by ID with `getFieldById()`. `forIds()` filters fields based on IDs, `asArray()` returns fields as an array, and `build()` validates and formats the fields. It includes the `getDefaultDimension` and `getDefaultMetric` which return the default dimension and metric.\n"],null,["# Class Fields\n\nFields\n\nContains a set of [Field](/apps-script/reference/data-studio/field)s for a community connector. This set of fields define which\ndimensions and metrics can be used in Data Studio.\n\n```javascript\nconst cc = DataStudioApp.createCommunityConnector();\nconst fields = cc.getFields();\n\nconst field1 = fields\n .newDimension()\n // Set other properties as needed.\n .setId('field1_id');\n``` \n\n### Methods\n\n| Method | Return type | Brief description |\n|--------------------------------------------------------------|-----------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|\n| [asArray()](#asArray()) | [Field[]](/apps-script/reference/data-studio/field) | Returns a view of this object as an array. |\n| [build()](#build()) | `Object[]` | Validates this object and returns it in the format needed by Data Studio. |\n| [forIds(ids)](#forIds(String)) | [Fields](#) | Returns a new [Fields](#) object filtered to [Field](/apps-script/reference/data-studio/field)s with an ID in `ids`. |\n| [getDefaultDimension()](#getDefaultDimension()) | [Field](/apps-script/reference/data-studio/field) | Returns the default dimension to be used for the set of fields. |\n| [getDefaultMetric()](#getDefaultMetric()) | [Field](/apps-script/reference/data-studio/field) | Returns the default metric to be used for the set of fields. |\n| [getFieldById(fieldId)](#getFieldById(String)) | [Field](/apps-script/reference/data-studio/field) | Returns a field with a given ID, or `null` if no field with that ID is in this [Fields](#) object. |\n| [newDimension()](#newDimension()) | [Field](/apps-script/reference/data-studio/field) | Returns a new dimension [Field](/apps-script/reference/data-studio/field). |\n| [newMetric()](#newMetric()) | [Field](/apps-script/reference/data-studio/field) | Returns a new metric [Field](/apps-script/reference/data-studio/field). |\n| [setDefaultDimension(fieldId)](#setDefaultDimension(String)) | `void` | Sets the default dimension to be used for the set of fields. |\n| [setDefaultMetric(fieldId)](#setDefaultMetric(String)) | `void` | Sets the default metric to be used for the set of fields. |\n\nDetailed documentation\n----------------------\n\n### `as``Array()`\n\nReturns a view of this object as an array.\n\n```javascript\nconst fields = DataStudioApp.createCommunityConnector().getFields();\nfields.newDimension().setId('field1_id');\nfields.newDimension().setId('field2_id');\nfields.newDimension().setId('field3_id');\n\n// Logging the ID of each field:\nfields.asArray().map((field) =\u003e {\n Logger.log(field.getId());\n});\n```\n\n#### Return\n\n\n[Field[]](/apps-script/reference/data-studio/field) --- An array of [Field](/apps-script/reference/data-studio/field) objects.\n\n*** ** * ** ***\n\n### `build()`\n\nValidates this object and returns it in the format needed by Data Studio.\n\n#### Return\n\n\n`Object[]` --- The validated field data, represented as a list of objects.\n\n#### Throws\n\n\n[`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) --- if a valid object cannot be constructed.\n\n*** ** * ** ***\n\n### `for``Ids(ids)`\n\nReturns a new [Fields](#) object filtered to [Field](/apps-script/reference/data-studio/field)s with an ID in `ids`.\n\n```javascript\nconst fields = DataStudioApp.createCommunityConnector().getFields();\nfields.newDimension().setId('field1_id');\nfields.newDimension().setId('field2_id');\nfields.newDimension().setId('field3_id');\n\n// subsetFields is a Fields object that only contains field1 and field2.\nconst subsetFields = fields.forIds(['field1_id', 'field3_id']);\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|-------|------------|----------------------------------------|\n| `ids` | `String[]` | The IDs of fields that should be kept. |\n\n#### Return\n\n\n[Fields](#) --- A new [Fields](#) object.\n\n*** ** * ** ***\n\n### `get``Default``Dimension()`\n\nReturns the default dimension to be used for the set of fields. The default dimension is\nselected automatically when a new visualization is made.\n\n#### Return\n\n\n[Field](/apps-script/reference/data-studio/field) --- The dimension that is set as the default dimension, or `null` if no default\ndimension was set.\n\n*** ** * ** ***\n\n### `get``Default``Metric()`\n\nReturns the default metric to be used for the set of fields. The default metric is selected\nautomatically when a new visualization is made.\n\n#### Return\n\n\n[Field](/apps-script/reference/data-studio/field) --- The metric that is set as the default metric, or `null` if no default metric was\nset.\n\n*** ** * ** ***\n\n### `get``Field``By``Id(fieldId)`\n\nReturns a field with a given ID, or `null` if no field with that ID is in this [Fields](#) object.\n\n```javascript\nconst fields = DataStudioApp.createCommunityConnector().getFields();\nconst field1 = fields.newDimension().setId('field1_id');\n\n// byId is the same as field1.\nconst byId = fields.getFieldById('field1_id');\n\n// byId2 is null.\nconst byId2 = fields.getFieldById('not present id');\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|-------------|----------|-----------------------------|\n| `field``Id` | `String` | The ID of the field to get. |\n\n#### Return\n\n\n[Field](/apps-script/reference/data-studio/field) --- The [Field](/apps-script/reference/data-studio/field) with the given ID, or `null` if no such field is contained\nwithin this [Fields](#) object.\n\n*** ** * ** ***\n\n### `new``Dimension()`\n\nReturns a new dimension [Field](/apps-script/reference/data-studio/field).\n\n#### Return\n\n\n[Field](/apps-script/reference/data-studio/field) --- A new dimension [Field](/apps-script/reference/data-studio/field).\n\n*** ** * ** ***\n\n### `new``Metric()`\n\nReturns a new metric [Field](/apps-script/reference/data-studio/field).\n\n#### Return\n\n\n[Field](/apps-script/reference/data-studio/field) --- A new metric [Field](/apps-script/reference/data-studio/field).\n\n*** ** * ** ***\n\n### `set``Default``Dimension(fieldId)`\n\nSets the default dimension to be used for the set of fields. The default dimension is selected\nautomatically when a new visualization is made.\n\n#### Parameters\n\n| Name | Type | Description |\n|-------------|----------|----------------------------------------------------------------------------------------------------|\n| `field``Id` | `String` | The ID of the field to use as the default dimension. This ID must be present in the set of fields. |\n\n*** ** * ** ***\n\n### `set``Default``Metric(fieldId)`\n\nSets the default metric to be used for the set of fields. The default metric is selected\nautomatically when a new visualization is made.\n\n#### Parameters\n\n| Name | Type | Description |\n|-------------|----------|-------------------------------------------------------------------------------------------------|\n| `field``Id` | `String` | The ID of the field to use as the default metric. This ID must be present in the set of fields. |"]]