> Documentation index: https://www.gooddata.ai/docs/gooddata-ui/llms.txt lists every page of these docs as Markdown.

# IWorkspaceComputedAttributesService

- Package: [@gooddata/sdk-backend-spi](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/index.md)
- Kind: interface
- Source: https://github.com/gooddata/gooddata-ui-sdk/blob/rel/11.64/libs/sdk-backend-spi/src/workspace/computedAttributes/index.ts

Service for create, update or delete computed attributes and querying them.

**Signature:**

```typescript
export interface IWorkspaceComputedAttributesService 
```

## Methods

| Method | Description |
| --- | --- |
| [createComputedAttribute(computedAttribute)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iworkspacecomputedattributesservice/index.md#iworkspacecomputedattributesservicecreatecomputedattribute) | Create and save computed attribute for the provided definition. |
| [deleteComputedAttribute(ref)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iworkspacecomputedattributesservice/index.md#iworkspacecomputedattributesservicedeletecomputedattribute) | Delete computed attribute with the given reference. |
| [getComputedAttribute(ref, options)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iworkspacecomputedattributesservice/index.md#iworkspacecomputedattributesservicegetcomputedattribute) | Get computed attribute by reference. |
| [getComputedAttributeExpressionTokens(ref)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iworkspacecomputedattributesservice/index.md#iworkspacecomputedattributesservicegetcomputedattributeexpressiontokens) | Get the expression tokens of the computed attribute's MAQL, with every referenced object resolved to its title. |
| [getComputedAttributeReferencingObjects(ref)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iworkspacecomputedattributesservice/index.md#iworkspacecomputedattributesservicegetcomputedattributereferencingobjects) | Get objects that reference the computed attribute. |
| [getComputedAttributesQuery()](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iworkspacecomputedattributesservice/index.md#iworkspacecomputedattributesservicegetcomputedattributesquery) | Computed attributes query factory. |
| [setCertification(ref, certification)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iworkspacecomputedattributesservice/index.md#iworkspacecomputedattributesservicesetcertification) | Sets computed attribute certification metadata. |
| [updateComputedAttribute(computedAttribute)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iworkspacecomputedattributesservice/index.md#iworkspacecomputedattributesserviceupdatecomputedattribute) | Update provided computed attribute. |
| [updateComputedAttributeMeta(computedAttribute)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iworkspacecomputedattributesservice/index.md#iworkspacecomputedattributesserviceupdatecomputedattributemeta) | Update metadata of the computed attribute. |

## Method details

### IWorkspaceComputedAttributesService.createComputedAttribute()

Create and save computed attribute for the provided definition.

**Signature:**

```typescript
createComputedAttribute(computedAttribute: IComputedAttributeMetadataObjectDefinition): Promise<IComputedAttributeMetadataObject>;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| computedAttribute | [IComputedAttributeMetadataObjectDefinition](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.icomputedattributemetadataobjectdefinition/index.md) | computed attribute definition |

**Returns:**

Promise&lt;[IComputedAttributeMetadataObject](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.icomputedattributemetadataobject/index.md)&gt;

promise of created computed attribute

### IWorkspaceComputedAttributesService.deleteComputedAttribute()

Delete computed attribute with the given reference.

**Signature:**

```typescript
deleteComputedAttribute(ref: ObjRef): Promise<void>;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| ref | [ObjRef](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.objref/index.md) | ref of the computed attribute to delete |

**Returns:**

Promise&lt;void&gt;

promise of undefined

### IWorkspaceComputedAttributesService.getComputedAttribute()

Get computed attribute by reference.

**Signature:**

```typescript
getComputedAttribute(ref: ObjRef, options?: IGetComputedAttributeOptions): Promise<IComputedAttributeMetadataObject>;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| ref | [ObjRef](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.objref/index.md) | ref of the computed attribute to get |
| options | [IGetComputedAttributeOptions](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.igetcomputedattributeoptions/index.md) | _(Optional)_ options for getting the computed attribute |

**Returns:**

Promise&lt;[IComputedAttributeMetadataObject](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.icomputedattributemetadataobject/index.md)&gt;

promise of computed attribute

### IWorkspaceComputedAttributesService.getComputedAttributeExpressionTokens()

Get the expression tokens of the computed attribute's MAQL, with every referenced object resolved to its title.

**Signature:**

```typescript
getComputedAttributeExpressionTokens(ref: ObjRef): Promise<IMeasureExpressionToken[]>;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| ref | [ObjRef](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.objref/index.md) | ref of the computed attribute |

**Returns:**

Promise&lt;[IMeasureExpressionToken](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.imeasureexpressiontoken/index.md)[]&gt;

promise of the expression tokens

### IWorkspaceComputedAttributesService.getComputedAttributeReferencingObjects()

Get objects that reference the computed attribute.

**Signature:**

```typescript
getComputedAttributeReferencingObjects(ref: ObjRef): Promise<IComputedAttributeReferencing>;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| ref | [ObjRef](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.objref/index.md) | ref of the computed attribute |

**Returns:**

Promise&lt;[IComputedAttributeReferencing](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.icomputedattributereferencing/index.md)&gt;

promise of the referencing objects

### IWorkspaceComputedAttributesService.getComputedAttributesQuery()

Computed attributes query factory.

**Signature:**

```typescript
getComputedAttributesQuery(): IComputedAttributesQuery;
```
**Returns:**

[IComputedAttributesQuery](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.icomputedattributesquery/index.md)

computed attributes query

### IWorkspaceComputedAttributesService.setCertification()

Sets computed attribute certification metadata.

**Signature:**

```typescript
setCertification(ref: ObjRef, certification?: IObjectCertificationWrite): Promise<void>;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| ref | [ObjRef](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.objref/index.md) | computed attribute reference |
| certification | IObjectCertificationWrite | _(Optional)_ certification state; undefined clears certification |

**Returns:**

Promise&lt;void&gt;

### IWorkspaceComputedAttributesService.updateComputedAttribute()

Update provided computed attribute.

**Signature:**

```typescript
updateComputedAttribute(computedAttribute: IComputedAttributeMetadataObject): Promise<IComputedAttributeMetadataObject>;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| computedAttribute | [IComputedAttributeMetadataObject](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.icomputedattributemetadataobject/index.md) | computed attribute to update |

**Returns:**

Promise&lt;[IComputedAttributeMetadataObject](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.icomputedattributemetadataobject/index.md)&gt;

promise of updated computed attribute

### IWorkspaceComputedAttributesService.updateComputedAttributeMeta()

Update metadata of the computed attribute.

**Signature:**

```typescript
updateComputedAttributeMeta(computedAttribute: Partial<IMetadataObjectBase> & IMetadataObjectIdentity): Promise<IComputedAttributeMetadataObject>;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| computedAttribute | Partial&lt;[IMetadataObjectBase](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.imetadataobjectbase/index.md)&gt; &amp; [IMetadataObjectIdentity](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.imetadataobjectidentity/index.md) | metadata update to apply |

**Returns:**

Promise&lt;[IComputedAttributeMetadataObject](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.icomputedattributemetadataobject/index.md)&gt;

promise of updated computed attribute
