# CollectionSortItem Class

> Stores data about fields that viewers use for sorting collection items.

- Product: Adobe PDF Library 21
- Language: Modern C++
- Version: 21.4.0
- HTML page: https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/CollectionSortItem
- Version index: https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/llms.txt

```cpp
class CollectionSortItem
```

**Namespace:** `datalogics_interface`

## Description

Stores data about fields that viewers use for sorting collection items.

Collections are aslo known as portfolios.

**Referenced by:** [`Collection`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Collection.md)

## Constructors

### CollectionSortItem

```cpp
datalogics_interface::CollectionSortItem::CollectionSortItem(const std::string &field_id, bool ascending)
```

*constructor*

**Parameters**

- `field_id` (`const std::string &`): the schema field's id.
- `ascending` (`bool`): true for ascending, false for descending

CCollectionSortItem allows to construct sort item which will be used for collection sorting.

## Methods

### get_ascending

```cpp
bool datalogics_interface::CollectionSortItem::get_ascending() const
```

**Returns:** `bool`

true if the sort order is ascending, false if descending.

Gets whether the sort order is ascending.

### get_name

```cpp
std::string datalogics_interface::CollectionSortItem::get_name() const
```

**Returns:** `std::string`

The field name to sort by.

Gets the field name used for sorting.

This is the schema field identifier that determines which collection field is used as the sort key.
