# \CGExtensions\reportstabular_report_defn_column

A column definition for a tabular report.

This class is used to indicate how to display a value for a certain cell.

## Summary

Methods
Properties
Constants
__construct()
get_label()
set_value_processor()
process_value()
add_history_value()
add_group_history_value()
changed()
reset_group()
get_count()
get_min()
get_max()
get_sum()
get_mean()
get_median()
get_grp_count()
get_grp_min()
get_grp_max()
get_grp_sum()
get_grp_mean()
get_grp_median()
get_key()
get_template()
set_template()
get_alignment()
get_span()
get_class()
set_class()
No public properties found
ALIGN_LEFT
ALIGN_RIGHT
ALIGN_CENTER
get_grp_values()
No protected properties found
N/A
No private methods found
No private properties found
N/A

File
  lib/reports/class.tabular_report_defn.php
Class hierarchy
  \CGExtensions\reports\tabular_report_cellfmt
  \CGExtensions\reports\tabular_report_defn_column

## Tags

todo |

## Constants

### ALIGN_LEFT

    ALIGN_LEFT

#

Inherited from
  \CGExtensions\reports\tabular_report_cellfmt

## Tags

todo |

### ALIGN_RIGHT

    ALIGN_RIGHT

#

Inherited from
  \CGExtensions\reports\tabular_report_cellfmt

## Tags

todo |

### ALIGN_CENTER

    ALIGN_CENTER

#

Inherited from
  \CGExtensions\reports\tabular_report_cellfmt

## Tags

todo |

## Methods

### __construct()

    __construct(string $key, string $tpl, string $align, int $span)

Construct a new tabular_report_cellfmt.

#### Parameters

string | $key | The name of the column (must match a defined column).
string | $tpl | The smarty template for displaying values for this cell. Default value is '{$val}'.
string | $align | The alignment for this cell. See the ALIGN constants in this class.
int | $span | The number of columns this cell should span. Some generators may ignore this.

#

Inherited from
  \CGExtensions\reports\tabular_report_cellfmt

## Tags

todo |

### get_label()

    get_label() : string

Get the label for this column definition.

#### Returns

string

#

## Tags

todo |

### set_value_processor()

    set_value_processor(callable $fn)

Set an optional mechanism to adjust, process, or return a different value for values in this column.

This can be used for doing mathematical formulas on values, or retrieving foreign key related data from the database or otherwise translating input data.

#### Parameters

callable | $fn | A callable function that is of the form func(string $value,\CGExtensions\query\resultset)

#

## Tags

todo |

### process_value()

    process_value(string $val, \CGExtensions\query\resultset $rs)

A callback method to process a value in this column.

by default this method will call the value processor callback (if defined), otherwise it will do nothing. This method is normally called by the report generator to determine the output value (but not the displayed string) for the column.

#### Parameters

string | $val | The current value for this column.
\CGExtensions\query\resultset | $rs | The resultset object.

#

## Tags

todo |

### add_history_value()

    add_history_value(string $val)

Save a value for this column. Useful in calcualting statistics that are global to the entire report.

This method is normally called by the report generator.

#### Parameters

string | $val |

#

## Tags

todo |

### add_group_history_value()

    add_group_history_value(string $grp_key, string $val)

Add a group history value. Useful in calculating statistics for a specific group.

This method is normally called by the report generator.

#### Parameters

string | $grp_key | The name of the group
string | $val |

#

## Tags

todo |

### changed()

    changed(string $val) : bool

A function to test if the supplied value for this column has changed from the previous global value. This can be useful for detecting if a group has changed.

This method is normally called by the report generator.

#### Parameters

string | $val |

#### Returns

bool

#

## Tags

todo |

### reset_group()

    reset_group(string $grp_key)

Clear all cached values for a specified group

#### Parameters

string | $grp_key | The name of the group

#

## Tags

todo |

### get_count()

    get_count() : int

Get the count of values stored for this column.

#### Returns

int

#

See also

## Tags

todo |

### get_min()

    get_min() : string

Get the minimum of all values stored for this column.

This method assumes that the data stored is in someway numeric, and can be compared using numeric operators.

#### Returns

string

#

## Tags

todo |

### get_max()

    get_max() : string

Get the maximum of all values stored for this column.

This method assumes that the data stored is in someway numeric, and can be compared using numeric operators.

#### Returns

string

#

## Tags

todo |

### get_sum()

    get_sum() : string

Get the sum of all values stored for this column.

This method assumes that the data stored is in someway numeric, and can be compared using numeric operators.

#### Returns

string

#

## Tags

todo |

### get_mean()

    get_mean() : string

Get the mean/average of all values stored for this column.

This method assumes that the data stored is in someway numeric, and can be compared using numeric operators.

#### Returns

string

#

## Tags

todo |

### get_median()

    get_median() : string

Get the median/middle of all values stored for this column.

This method assumes that the data stored is in someway numeric, and can be compared using numeric operators.

#### Returns

string

#

## Tags

todo |

### get_grp_count()

    get_grp_count(string $grp_key) : int

Get the count of all values stored for this column for the specified group.

#### Parameters

string | $grp_key |

#### Returns

int

#

## Tags

todo |

### get_grp_min()

    get_grp_min(string $grp_key) : string

Get the minimum of all values stored for this column for the specified group This method assumes that the data stored is in someway numeric, and can be compared using numeric operators.

#### Parameters

string | $grp_key |

#### Returns

string

#

## Tags

todo |

### get_grp_max()

    get_grp_max(string $grp_key) : string

Get the maximum of all values stored for this column for the specified group This method assumes that the data stored is in someway numeric, and can be compared using numeric operators.

#### Parameters

string | $grp_key |

#### Returns

string

#

## Tags

todo |

### get_grp_sum()

    get_grp_sum(string $grp_key) : string

Get the sum of all values stored for this column for the specified group This method assumes that the data stored is in someway numeric, and can be compared using numeric operators.

#### Parameters

string | $grp_key |

#### Returns

string

#

## Tags

todo |

### get_grp_mean()

    get_grp_mean(string $grp_key) : string

Get the mean/average of all values stored for this column for the specified group This method assumes that the data stored is in someway numeric, and can be compared using numeric operators.

#### Parameters

string | $grp_key |

#### Returns

string

#

## Tags

todo |

### get_grp_median()

    get_grp_median(string $grp_key) : string

Get the median/middle of all values stored for this column for the specified group This method assumes that the data stored is in someway numeric, and can be compared using numeric operators.

#### Parameters

string | $grp_key |

#### Returns

string

#

## Tags

todo |

### get_key()

    get_key() : string

Get the key (column name) for this object.

#### Returns

string

#

Inherited from
  \CGExtensions\reports\tabular_report_cellfmt

## Tags

todo |

### get_template()

    get_template() : string

Get the template for values in this cell format

#### Returns

string

#

Inherited from
  \CGExtensions\reports\tabular_report_cellfmt

## Tags

todo |

### set_template()

    set_template(string $tpl)

Set the template for values in this cell format.

#### Parameters

string | $tpl | Smarty template. It should be simple, and used for displaying a single value.

#

Inherited from
  \CGExtensions\reports\tabular_report_cellfmt

## Tags

todo |

### get_alignment()

    get_alignment() : string

Get the alignment for cells using this format.

#### Returns

string

#

Inherited from
  \CGExtensions\reports\tabular_report_cellfmt

## Tags

todo |

### get_span()

    get_span() : int

Get the cell span for cells using this format.

#### Returns

int

#

Inherited from
  \CGExtensions\reports\tabular_report_cellfmt

## Tags

todo |

### get_class()

    get_class() : string

Get the class name (if any) assigned to this cell format

#### Returns

string

#

Inherited from
  \CGExtensions\reports\tabular_report_cellfmt

## Tags

todo |

### set_class()

    set_class(string $class)

Set a class name to use when outputting cells using this format.

Some generators may ignore this value. But HTML type generators will typically use this as a class name for the table cell.

#### Parameters

string | $class |

#

Inherited from
  \CGExtensions\reports\tabular_report_cellfmt

## Tags

todo |

### get_grp_values()

    get_grp_values(string $grp_key) : string[]

Get all of the values stored for this column for the named group.

#### Parameters

string | $grp_key |

#### Returns

string[]

#

## Tags

todo |

### class.tabular_report_defn.php