Methods returning information

The report class has some extra convenience methods to provide you with useful information.

class Report

The report class offers a lot of methods which delivers almost all information you need to create your application.

getRow(int $dimID = null)

Get the active row for the requested dimension.

Parameters
  • $dimID (int|null) – The data dimension for which you want the current row. Defaults to the current data dimension. If $dimID is negative the value will be subtracted from the current data dimension.

Returns

The active data row for the requested dimension.

getRowKey($dimID)

Get key of the active row for the requested dimension.

Parameters
  • $dimID (int|null) – Same as in getRow().

Returns

The requested key.

isFirst($level = null): bool

Checks if the current group is the first one within the next higher group. e.g. Is it the first invoice for a customer.

Parameters
  • $level (string|int|null) – The group level to be checked. Defaults to the next higher group level.

Returns

True when the current group is the first one within the givel level. False when not.

isLast($level = null): bool

Check if the current group footer action is executed the last time within the group level. The question can only be answered in group footers.

Parameters
  • $level (string|int|null) – The group level to be checked. Defaults to the next higher group level.

Returns

True when the current action is executed the last time within the given group level. False when not.

Throws

InvalidArgumentException when method is not called in a group footer or asked for group levels not higher than the current one.

getLevel($groupName = null): int

Get the current group level or the level associated with the group name.

Parameters
  • $groupName (string|null) – The name of the group. Null for the current group level.

Returns

The requested group level

getGroupValues(?int $dimID = null, bool $fromFirstLevel = true): array

Get all active group values. Note that in footer methods the row which triggered the group change is not yet active.

Parameters
  • $dimID (int|null) – The dimension id for / till the group values will be returned. Defaults to the current dimension id.

  • $fromFirstLevel (bool) – When true all group values from the first dimension to the requested dimension are returned. When false only the group values of the requested dimension are returned.

Returns

Array with requested group values indexed by group level.

getGroupValue($group = null)

Get the current value for the requested group.

Parameters
  • $group (int|null|string) – String representing the group name or integer representing the group level. When null it defaults to the current group level. Negative values are substracted from the current level.

Returns

Current value of the requested group.

getGroupNames(): array

Get all group names.

Returns array

Array of all group names.

getGroupName(int $groupLevel): string

Get the associated group name of the group level.

Parameters
  • $groupLevel (int) – The level of the group.

Returns string

The associated group name of the level.

getDimId(mixed $level): int

Get the dimension ID for a given group level.

Parameters
  • $groupLevel (mixed) – The level of the group. Defaults to the current level.

Returns int

The dimension id.