---
name: "tvSortByValue"
type: command
status: ok
groups: ["GUI Control - Tree View"]
arma3_since: "0.74"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/tvSortByValue
revid: 378381
updated: 2026-04-04T04:47:06Z
---

# tvSortByValue

*Command · GUI Control - Tree View · Arma 3 v0.74*

## Description

Sorts all children of given path. Value of Tree View entries is used for sorting. [tvSetValue](../commands/tvSetValue.md) can be used to set the value for a given path.

## Syntax

### Syntax 1

```sqf
control tvSortByValue [path, ascending]
```

**Parameters:**

- `control`: [Control](../topics/Control.md)
- `path`: [Tree View Path](../topics/Tree_View_Path.md) - the parent item to sort
- `ascending`: [Boolean](../topics/Boolean.md) - (Optional, default [false](../commands/false.md)) [true](../commands/true.md) to sort ascending, else descending

**Returns:** [Nothing](../topics/Nothing.md)

### Syntax 2

```sqf
tvSortByValue [idc, path, ascending]
```

**Parameters:**

- `idc`: [Number](../topics/Number.md) - control idc
- `path`: [Tree View Path](../topics/Tree_View_Path.md) - the parent item to sort
- `ascending`: [Boolean](../topics/Boolean.md) - (Optional) [true](../commands/true.md) to sort ascending, else descending. Default: [false](../commands/false.md)

**Returns:** [Nothing](../topics/Nothing.md)

## Examples

### Example 1

```sqf
control tvSortByValue [[0], false];
```

### Example 2

```sqf
tvSortByValue [102, [0], false];
```

## See also

[lbSortBy](../commands/lbSortBy.md) · [lnbSortBy](../commands/lnbSortBy.md) · [tvSortAll](../commands/tvSortAll.md) · [tvSort](../commands/tvSort.md) · [tvSortByValueAll](../commands/tvSortByValueAll.md)

<sub>Source: [BI Community Wiki — tvSortByValue](https://community.bistudio.com/wiki/tvSortByValue) (revision 378381).</sub>
