Contains field-related data. Its properties determine how the field is used in Data Studio.
const cc = DataStudioApp.createCommunityConnector(); const fields = cc.getFields(); const field1 = fields.newDimension() .setId('field1_id') .setName('Field 1 ID') .setDescription('The first field.') .setType(cc.FieldType.YEAR_MONTH) .setGroup('DATETIME');
Methods
Method | Return type | Brief description |
---|---|---|
get | Aggregation | Returns the Aggregation of this Field . |
get | String | Returns the description of this Field . |
get | String | Returns the formula of this Field . |
get | String | Returns the group of this Field . |
get | String | Returns the ID of this Field . |
get | Boolean | Returns true if this field can be reaggregated, false otherwise. |
get | String | Returns the name of this Field . |
get | Field | Returns the Field of this Field . |
is | Boolean | Returns true if this Field is the default metric or dimension. |
is | Boolean | Returns true if this field is a dimension. |
is | Boolean | Returns true if this Field is hidden. |
is | Boolean | Returns true if this field is a metric. |
set | Field | Sets the aggregation type of this Field . |
set | Field | Sets the description of this Field . |
set | Field | Sets the formula of this Field . |
set | Field | Sets the group of this Field . |
set | Field | Sets the ID of this Field . |
set | Field | Sets the hidden status of this Field . |
set | Field | Sets the reaggregation-permitted status for a Field . |
set | Field | Sets the name of this Field . |
set | Field | Sets the Field of this Field . |
Detailed documentation
getAggregation()
Returns the Aggregation
of this Field
. Aggregation
determines
how Data Studio combines similar data into dimensions.
Return
Aggregation
— The aggregationType for this field.
getDescription()
Returns the description of this Field
. Descriptions are short explanations of a field's
purpose.
Return
String
— The description for this field.
getFormula()
Returns the formula of this Field
. Formulas define a data transformation that Data
Studio runs at query-time.
Return
String
— The formula for this field.
getGroup()
Returns the group of this Field
. Fields collected into a group are presented together
in the Data Studio UI.
Return
String
— The group for this field.
getId()
Returns the ID of this Field
. IDs are unique per set of fields and are used in formulas
to refer to fields.
Return
String
— The ID for this field.
getIsReaggregatable()
Returns true
if this field can be reaggregated, false
otherwise.
Return
Boolean
— true
if this field can be reaggregated, false
otherwise.
getName()
Returns the name of this Field
. Names are shown to the user to distinguish fields.
Return
String
— The name for this field.
isDefault()
isDimension()
Returns true
if this field is a dimension.
Return
Boolean
— true
if this field is a dimension; returns false
otherwise.
isHidden()
isMetric()
Returns true
if this field is a metric.
Return
Boolean
— true
if this field is a metric; returns false
otherwise.
setAggregation(aggregation)
Sets the aggregation type of this Field
. Aggregation
determines how Data
Studio combines similar data into dimensions. This throws an error if called on a metric.
Parameters
Name | Type | Description |
---|---|---|
aggregation | Aggregation | The aggregation type to set. |
Return
Field
— This builder, for chaining.