MeasureBuilderBase
Abstract base class for measure builders. Measure builders allow for incremental, fluent construction and modification of measures.
export declare abstract class MeasureBuilderBase<T extends IMeasureDefinitionType>
Remarks
You should not be instantiating the builders directly. Instead, rely on the different functions to create different types of measures.
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the MeasureBuilderBase class.
Properties
Property | Modifiers | Type | Description |
|---|---|---|---|
(alias?: string) => this | Sets alias - alternative title - for the measure. | ||
() => IMeasure<T> | |||
| boolean | ||
() => this | Resets format string to the server-defined value. | ||
() => this | Indicates that the measure’s localId should be generated using the default local-id generator logic. | ||
(format?: string) => this | Sets measure format to use when rendering values calculated from this measure. | ||
(localId?: Identifier) => this | Sets local identifier (localId) for the measure. LocalId can be used to reference the measure within the execution definition. | ||
() => this | Resets alias - alternative title - set for the measure. | ||
() => this | Resets alternative title for the measure. The server-defined title of the measure will be used instead. | ||
(title?: string) => this | Sets alternative title for the measure. |
Methods
Method | Modifiers | Description |
|---|---|---|
| Build of measure definition is responsibility of the subclass. | |
| Generation of local identifier is a responsibility shared with the the subclass - so that the concrete builders can use their concrete definition to provide additional parts of the local id. | |
| The measure builder subclasses must call this when they are used to modify an existing measure. Existing measure modification returns a new object that reflects the mods however it keeps the localId set as-is. |
Property details
MeasureBuilderBase.aliasproperty
Sets alias - alternative title - for the measure.
alias: (alias?: string) => this;
Remarks
This value will then be used in various chart-specific descriptive elements. For convenience if no alias is specified, the measure will fall back to using either title (if specified) or server-defined title as the ultimate fallback
MeasureBuilderBase.buildproperty
build: () => IMeasure<T>;
MeasureBuilderBase.customLocalIdproperty
protected customLocalId: boolean;
MeasureBuilderBase.defaultFormatproperty
Resets format string to the server-defined value.
defaultFormat: () => this;
MeasureBuilderBase.defaultLocalIdproperty
Indicates that the measure’s localId should be generated using the default local-id generator logic.
defaultLocalId: () => this;
MeasureBuilderBase.formatproperty
Sets measure format to use when rendering values calculated from this measure.
format: (format?: string) => this;
Remarks
The format string is described in more detail here https://help.gooddata.com/doc/en/reporting-and-dashboards/reports/working-with-reports/formatting-numbers-in-reports.
For convenience, if you do not specify any format, then a default server-defined value will be used instead.
MeasureBuilderBase.localIdproperty
Sets local identifier (localId) for the measure. LocalId can be used to reference the measure within the execution definition.
localId: (localId?: Identifier) => this;
Remarks
Normally, builder will generate localId based on contents of the measure definition - taking all properties into account: in typical scenarios you don’t have to call this function at all. The only exception where you have to provide custom local id is if your execution must contain the exact same measure twice.
For convenience, this method also accepts ‘undefined’, which indicates that the default local id generation logic should be used.
MeasureBuilderBase.noAliasproperty
Resets alias - alternative title - set for the measure.
noAlias: () => this;
Remarks
The measure title will be used if specified, otherwise the server-defined title will be used instead.
MeasureBuilderBase.noTitleproperty
Resets alternative title for the measure. The server-defined title of the measure will be used instead.
noTitle: () => this;
MeasureBuilderBase.titleproperty
Sets alternative title for the measure.
title: (title?: string) => this;
Remarks
This value will then be used in various chart-specific descriptive elements. For convenience if no title is specified, the measure will fall back to server-defined value.
Method details
MeasureBuilderBase.buildDefinition()method
Build of measure definition is responsibility of the subclass.
protected abstract buildDefinition(): T;
Returns
T
new instance
MeasureBuilderBase.generateLocalId()method
Generation of local identifier is a responsibility shared with the the subclass - so that the concrete builders can use their concrete definition to provide additional parts of the local id.
protected abstract generateLocalId(): string;
Returns
string
local identifier
MeasureBuilderBase.initializeFromExisting()method
The measure builder subclasses must call this when they are used to modify an existing measure. Existing measure modification returns a new object that reflects the mods however it keeps the localId set as-is.
protected initializeFromExisting(measure: MeasureEnvelope): void;
Parameters
Parameter | Type | Description |
|---|---|---|
measure | envelope of measure being modified |
Returns
void