---
url: /process-functions/hierarchy-childbyindex.md
description: Returns the name of a child of a parent element.
---

# hierarchy.childByIndex

Returns the name of a child of a parent element.

```js
hierarchy.childByIndex(dimension, hierarchy, element, index)
```

## Parameters

| Parameter | Type | Description |
|---|---|---|
| `dimension` | `string` | The dimension's name or id. |
| `hierarchy` | `string` | The hierarchy's name or id. |
| `element` | `string` | The parent element's name. |
| `index` | `number` | The child's position under the parent, starting at `0`. |

## Returns

The child's name, or a message starting with `"Error:"` when there's no child at that position or the dimension or hierarchy can't be found.

## Examples

```js
const child = hierarchy.childByIndex("Account", "Management Profit and Loss", "EBIT", 0);
```

`child` is the name of the first child of `EBIT` in the Management Profit and Loss hierarchy.
