# BalancesDataTableBuilder

A BalancesDataTableBuilder is used to setup and build two-dimensional arrays containing balance information.

## Implements

- `BalancesDataTableBuilder`

### Constructor

```ts
new BalancesDataTableBuilder(
   book, 
   balancesContainers, 
   periodicity): BalancesDataTableBuilder;
```

#### Parameters

| Parameter | Type |
| :------ | :------ |
| `book` | [`Book`](https://bkper.com/docs/api/bkper-js/classes/book.md) |
| `balancesContainers` | [`BalancesContainer`](https://bkper.com/docs/api/bkper-js/interfaces/balancescontainer.md)[] |
| `periodicity` | [`Periodicity`](https://bkper.com/docs/api/bkper-js/enumerations/periodicity.md) |

#### Returns

`BalancesDataTableBuilder`

### build()

```ts
build(): any[][];
```

Builds an two-dimensional array with the balances.

#### Returns

`any`[][]

#### Implementation of

```ts
BalancesDataTableBuilder.build
```

***

### expanded()

```ts
expanded(expanded): BalancesDataTableBuilder;
```

Defines whether Groups should expand its child accounts.

true to expand itself
-1 to expand all subgroups
-2 to expand all accounts
0 to expand nothing
1 to expand itself and its first level of children
2 to expand itself and its first two levels of children
etc.

#### Parameters

| Parameter | Type |
| :------ | :------ |
| `expanded` | `number` \| `boolean` |

#### Returns

`BalancesDataTableBuilder`

This builder with respective expanded option, for chaining.

#### Implementation of

```ts
BalancesDataTableBuilder.expanded
```

***

### formatDates()

```ts
formatDates(format): BalancesDataTableBuilder;
```

Defines whether the dates should be ISO formatted YYYY-MM-DD. E.g. 2025-01-01

#### Parameters

| Parameter | Type |
| :------ | :------ |
| `format` | `boolean` |

#### Returns

`BalancesDataTableBuilder`

This builder with respective formatting option, for chaining.

#### Implementation of

```ts
BalancesDataTableBuilder.formatDates
```

***

### formatValues()

```ts
formatValues(format): BalancesDataTableBuilder;
```

Defines whether the value should be formatted based on decimal separator of the [[Book]].

#### Parameters

| Parameter | Type |
| :------ | :------ |
| `format` | `boolean` |

#### Returns

`BalancesDataTableBuilder`

This builder with respective formatting option, for chaining.

#### Implementation of

```ts
BalancesDataTableBuilder.formatValues
```

***

### hiddenProperties()

```ts
hiddenProperties(include): BalancesDataTableBuilder;
```

Defines whether to include hidden properties (keys ending with underscore "_").
Only relevant when [properties](https://bkper.com/docs/api/bkper-js/classes/balancesdatatablebuilder.md#properties) is enabled.
Default is false — hidden properties are excluded.

#### Parameters

| Parameter | Type | Description |
| :------ | :------ | :------ |
| `include` | `boolean` | Whether to include hidden properties |

#### Returns

`BalancesDataTableBuilder`

This builder with respective option, for chaining.

#### Implementation of

```ts
BalancesDataTableBuilder.hiddenProperties
```

***

### hideDates()

```ts
hideDates(hide): BalancesDataTableBuilder;
```

Defines whether the dates should be hidden for **PERIOD** or **CUMULATIVE** [[BalanceType]].

#### Parameters

| Parameter | Type |
| :------ | :------ |
| `hide` | `boolean` |

#### Returns

`BalancesDataTableBuilder`

This builder with respective hide dates option, for chaining.

#### Implementation of

```ts
BalancesDataTableBuilder.hideDates
```

***

### hideNames()

```ts
hideNames(hide): BalancesDataTableBuilder;
```

Defines whether the [[Accounts]] and [[Groups]] names should be hidden.

#### Parameters

| Parameter | Type |
| :------ | :------ |
| `hide` | `boolean` |

#### Returns

`BalancesDataTableBuilder`

This builder with respective hide names option, for chaining.

#### Implementation of

```ts
BalancesDataTableBuilder.hideNames
```

***

### period()

```ts
period(period): BalancesDataTableBuilder;
```

Defines whether should force use of period balances for **TOTAL** [[BalanceType]].

#### Parameters

| Parameter | Type |
| :------ | :------ |
| `period` | `boolean` |

#### Returns

`BalancesDataTableBuilder`

This builder with respective trial option, for chaining.

#### Implementation of

```ts
BalancesDataTableBuilder.period
```

***

### properties()

```ts
properties(include): BalancesDataTableBuilder;
```

Defines whether include custom [[Accounts]] and [[Groups]] properties.

#### Parameters

| Parameter | Type |
| :------ | :------ |
| `include` | `boolean` |

#### Returns

`BalancesDataTableBuilder`

This builder with respective include properties option, for chaining.

#### Implementation of

```ts
BalancesDataTableBuilder.properties
```

***

### raw()

```ts
raw(raw): BalancesDataTableBuilder;
```

Defines whether should show raw balances, no matter the credit nature of the Account or Group.

#### Parameters

| Parameter | Type |
| :------ | :------ |
| `raw` | `boolean` |

#### Returns

`BalancesDataTableBuilder`

This builder with respective trial option, for chaining.

#### Implementation of

```ts
BalancesDataTableBuilder.raw
```

***

### transposed()

```ts
transposed(transposed): BalancesDataTableBuilder;
```

Defines whether should rows and columns should be transposed.

For **TOTAL** [[BalanceType]], the **transposed** table looks like:

```
  _____________________________
 |  Expenses | Income  |  ...  |
 | -4568.23  | 5678.93 |  ...  |
 |___________|_________|_______|

```
Two rows, and each [[Account]] or [[Group]] per column.

For **PERIOD** or **CUMULATIVE** [[BalanceType]], the **transposed** table will be a time table, and the format looks like:

```
  _______________________________________________________________
 |            | Expenses   | Income     |     ...    |    ...    |
 | 15/01/2014 | -2345.23   |  3452.93   |     ...    |    ...    |
 | 15/02/2014 | -2345.93   |  3456.46   |     ...    |    ...    |
 | 15/03/2014 | -2456.45   |  3567.87   |     ...    |    ...    |
 |     ...    |     ...    |     ...    |     ...    |    ...    |
 |____________|____________|____________|____________|___________|

```

First column will be each Date, and one column for each [[Account]] or [[Group]].

#### Parameters

| Parameter | Type |
| :------ | :------ |
| `transposed` | `boolean` |

#### Returns

`BalancesDataTableBuilder`

This builder with respective transposed option, for chaining.

#### Implementation of

```ts
BalancesDataTableBuilder.transposed
```

***

### trial()

```ts
trial(trial): BalancesDataTableBuilder;
```

Defines whether should split **TOTAL** [[BalanceType]] into debit and credit.

#### Parameters

| Parameter | Type |
| :------ | :------ |
| `trial` | `boolean` |

#### Returns

`BalancesDataTableBuilder`

This builder with respective trial option, for chaining.

#### Implementation of

```ts
BalancesDataTableBuilder.trial
```

***

### type()

```ts
type(type): BalancesDataTableBuilder;
```

Fluent method to set the [[BalanceType]] for the builder.

#### Parameters

| Parameter | Type | Description |
| :------ | :------ | :------ |
| `type` | [`BalanceType`](https://bkper.com/docs/api/bkper-js/enumerations/balancetype.md) | The type of balance for this data table For **TOTAL** [[BalanceType]], the table format looks like: `_____________________ | Expenses | -4568.23 | | Income | 5678.93 | | ... | ... | |___________|__________|` Two columns, and each [[Account]] or [[Group]] per line. For **PERIOD** or **CUMULATIVE** [[BalanceType]], the table will be a time table, and the format looks like: `_______________________________________________________________ | | 15/01/2014 | 15/02/2014 | 15/03/2014 | ... | | Expenses | -2345.23 | -2345.93 | -2456.45 | ... | | Income | 3452.93 | 3456.46 | 3567.87 | ... | | ... | ... | ... | ... | ... | |____________|____________|____________|____________|___________|` First column will be the [[Account]] or [[Group]] name, and one column for each Date. |

#### Returns

`BalancesDataTableBuilder`

This builder with respective balance type, for chaining.

#### Implementation of

```ts
BalancesDataTableBuilder.type
```
