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

# newDefForBuckets()

- Package: [@gooddata/sdk-model](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/index.md)
- Kind: function
- Source: https://github.com/gooddata/gooddata-ui-sdk/blob/rel/11.64/libs/sdk-model/src/execution/executionDefinition/factory.ts

Prepares a new execution definition for a list of buckets.

**Signature:**

```typescript
export declare function newDefForBuckets(workspace: string, buckets: IBucket[], filters?: INullableFilter[]): IExecutionDefinition;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| workspace | string | workspace to execute against, must not be empty |
| buckets | [IBucket](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.ibucket/index.md)[] | list of buckets with attributes and measures, must be non empty, must have at least one attr or measure |
| filters | [INullableFilter](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.inullablefilter/index.md)[] | _(Optional)_ optional, may not be provided |

**Returns:**

[IExecutionDefinition](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.iexecutiondefinition/index.md)

## Remarks

Attributes and measures WILL be transferred to the execution in natural order:

- Order of items within a bucket is retained in the execution - Items from first bucket appear before items from second bucket

Or more specifically, given two buckets with items as [A1, A2, M1] and [A3, M2, M3], the resulting prepared execution WILL have definition with attributes = [A1, A2, A3] and measures = [M1, M2, M3]

This function MUST be used to implement IExecutionFactory.forBuckets();
