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

# newAttributeSort()

- 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/base/sort.ts
- Guides: [Working with attributes](https://www.gooddata.ai/docs/gooddata-ui/latest/data-layer/data-model/attributes/index.md)

Creates a new attribute sort - sorting the result by values of the provided attribute's elements.

**Signature:**

```typescript
export declare function newAttributeSort(attributeOrId: IAttribute | string, sortDirection?: SortDirection): IAttributeSortItem;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| attributeOrId | [IAttribute](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.iattribute/index.md) \| string | attribute to sort by |
| sortDirection | [SortDirection](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.sortdirection/index.md) | _(Optional)_ asc or desc, defaults to "asc" |

**Returns:**

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

always new item

## Remarks

The attribute can be either specified by value or by reference using its local identifier.
