12.13. The OpenCReport\Report class #

12.13.1. Get the next report
12.13.2. Create a new report variable
12.13.3. Create a new custom report variable
12.13.4. Get the first variable of a report
12.13.5. Parse and expression for the report
12.13.6. Get the error after a failed expression parsing
12.13.7. Resolve variables of the report
12.13.8. Evaluate variables of the report
12.13.9. Create a new report break
12.13.10. Get a report break by its name
12.13.11. Get the first report break
12.13.12. Resolve breaks of the report
12.13.13. Get the current row number of the main query
12.13.14. Add a "report start" callback
12.13.15. Add a "report done" callback
12.13.16. Add a "new row" callback
12.13.17. Add an "iteration done" callback
12.13.18. Add a "precalculation done" callback
12.13.19. Check whether two report objects are the same
12.13.20. Set the report's main query
12.13.21. Set the report's main query by name
12.13.22. Set or get the report suppression
12.13.23. Set or get number of iterations for the report
12.13.24. Set or get the font name for the report
12.13.25. Set or get the font size for the report
12.13.26. Set or get the report height
12.13.27. Set or get the report's field header prioroty
12.13.28. Get output sections of the report

class OpenCReport\Report {
    public final get_next():
                     ?OpenCReport\Report;

    public final variable_new(
                     long $variable_type,
                     string $name,
                     string $expr,
                     ?string $ignoreexpr = null,
                     ?string $reset_on_break_name = null,
                     ?bool $precalculate = false):
                     OpenCReport\Variable;

    public final variable_new_full(
                     long $result_type,
                     string $name,
                     ?string $baseexpr = null,
                     ?string $ignoreexpr = null,
                     ?string $intermedexpr = null,
                     ?string $intermed2expr = null,
                     ?string $resultexpr = null,
                     ?string $reset_on_break_name = null,
                     ?bool $precalculate = fals):
                     OpenCReport\Variable;

    public full variable_get_first():
                     ?OpenCReport\Variable;

    public final expr_parse(
                     string $expr_string):
                     ?OpenCReport\Expr;

    public final expr_error(): ?string;

    public final resolve_variables(): void;

    public final evaluate_variables(): void;

    public final break_new(
                     ?string $name):
                     OpenCReport\ReportBreak;

    public final break_get(
                     string $break_name):
                     OpenCReport\ReportBreak;

    public final break_get_first():
                     ?OpenCReport\ReportBreak;

    public final resolve_breaks(): void;

    public final get_query_rownum(): long;

    public final add_start_cb(
                     string $callback): void;

    public final add_done_cb(
                     string $callback): void;

    public final add_new_row_cb(
                     string $callback): void;

    public final add_iteration_cb(
                     string $callback): void;

    public final add_precalculation_done_cb(
                     string $callback): void;

    public final equals(
                     OpenCReport\Report $report):
                     bool;

    public final set_main_query(
                     OpenCReport\Query $query): void;

    public final set_main_query_by_name(
                     string $query_name): void;

    public final set_suppress(
                     ?string $expr_string = null):
                     ?OpenCReport\Expr;

    public final get_suppress():
                     ?OpenCReport\Expr;

    public final set_iterations(
                     ?string $expr_string = null):
                     ?OpenCReport\Expr;

    public final get_iterations():
                     ?OpenCReport\Expr;

    public final set_font_name(
                     ?string $expr_string = null):
                     ?OpenCReport\Expr;

    public final get_font_name():
                     ?OpenCReport\Expr;

    public final set_font_size(
                     ?string $expr_string = null):
                     ?OpenCReport\Expr;

    public final get_font_size():
                     ?OpenCReport\Expr;

    public final set_height(
                     ?string $expr_string = null):
                     ?OpenCReport\Expr;

    public final get_height():
                     ?OpenCReport\Expr;

    public final set_fieldheader_priority(
                     ?string $expr_string = null):
                     ?OpenCReport\Expr;

    public final get_fieldheader_priority():
                     ?OpenCReport\Expr;

    public final nodata(): OpenCReport\Output;
    public final header(): OpenCReport\Output;
    public final footer(): OpenCReport\Output;
    public final field_header(): OpenCReport\Output;
    public final field_details(): OpenCReport\Output;
}

12.13.1. Get the next report #

Get the next object in the chain of reports. This method may only be used on an object created with OpenCReport\Column::report_get_first(), i.e. one that was internally marked as an iterator object.

public final
OpenCReport\Report::get_next():
                     ?OpenCReport\Report;

12.13.2. Create a new report variable #

Create a new variable of the specified type and name, using the expression to produce the value. Optionally a break name (see Report breaks) may be specified, where, upon a break change, the variable is reset. See Report variables. For class methods of OpenCReport\Variable, see Section 12.14.

public const OpenCReport\Report::VARIABLE_EXPRESSION;
public const OpenCReport\Report::VARIABLE_COUNT;
public const OpenCReport\Report::VARIABLE_COUNTALL;
public const OpenCReport\Report::VARIABLE_SUM;
public const OpenCReport\Report::VARIABLE_AVERAGE;
public const OpenCReport\Report::VARIABLE_AVERAGEALL;
public const OpenCReport\Report::VARIABLE_LOWEST;
public const OpenCReport\Report::VARIABLE_HIGHEST;

public final
OpenCReport\Report::variable_new(
                     long $variable_type,
                     string $name,
                     string $expr,
                     ?string $ignoreexpr,
                     ?string $reset_on_break_name = null,
                     ?bool $precalculate = false):
                     OpenCReport\Variable;

A precalculated variable's value (or set of values) is calculated during the precalculation phase of report execution. When the report is being rendered, the precalculated values are used. This allows using an end value in a header, e.g. a report header may contain a summary of bottom line values. Similarly, break headers may show values that would otherwise be shown only in break footer sections for variables that are reset on a break.

12.13.3. Create a new custom report variable #

Create a new custom variable of the specified name, with total control over the base expression, intermediary expression(s) and the result expression. Optionally a break name (see Report breaks) may be specified, where, upon a break change, the variable is reset. See Report variables. For class methods of OpenCReport\Variable, see Section 12.14.

public final
OpenCReport\Report::variable_new_full(
                     long $result_type,
                     string $name,
                     ?string $baseexpr = null,
                     ?string $ignoreexpr,
                     ?string $intermedexpr = null,
                     ?string $intermed2expr = null,
                     ?string $resultexpr = null,
                     ?string $reset_on_break_name = null,
                     ?bool $precalculate = false):
                     OpenCReport\Variable;

12.13.4. Get the first variable of a report #

Get the first variable object in the chain of variables of the report. The object is marked internally as an iterator, so OpenCReport\Variable::get_next() may be used on it.

public final
OpenCReport\Report::variable_get_first():
                     ?OpenCReport\Variable;

12.13.5. Parse and expression for the report #

Parse and expression for the report. If the expression fails to parse, the method returns NULL and the error is found in OpenCReport\Report::expr_parse().

public final
OpenCReport\Report::expr_parse(
                     string $expr_string):
                     ?OpenCReport\Expr;

The main difference between OpenCReport::expr_parse() (see Section 12.4.4.1) and this method is that the former may not reference a report variable identifier. Since the expression for the former method is not associated with a report, report variable identifiers in the expression may not be resolved. The same applies to any function that is related to report internal details, e.g. the brrownum() function (see Break row number function: the expression is not associated with a report with breaks, the break name will not be found.

12.13.6. Get the error after a failed expression parsing #

public final
OpenCReport\Report::expr_error(): ?string;

12.13.7. Resolve variables of the report #

Resolve all variables of the report. This method may be useful to implement a custom report executor. The equivalent C function is used internally. This method is used by unit tests.

public final
OpenCReport\Report::resolve_variables(): void;

12.13.8. Evaluate variables of the report #

This method may be useful to implement a custom report executor. The equivalent C function is used internally. This method is used by unit tests.

public final
OpenCReport\Report::evaluate_variables(): void;

12.13.9. Create a new report break #

Create a new report break. A break is the basis for grouping data. See Report breaks. For the class methods of OpenCReport\ReportBreak, see Section 12.15.

public final
OpenCReport\Report::break_new(
                     ?string $name):
                     OpenCReport\ReportBreak;

12.13.10. Get a report break by its name #

Get a previously created break using its name. The object that's created this way is not marked as an iterator, so OpenCReport\ReportBreak::get_next() may not be used on it.

public final
OpenCReport\Report::break_get(
                     string $break_name):
                     OpenCReport\ReportBreak;

12.13.11. Get the first report break #

Get the first break object in the chain of breaks of the report. The object is marked internally as an iterator, so OpenCReport\ReportBreak::get_next() may be used on it.

public final
OpenCReport\Report::break_get_first():
                     ?OpenCReport\ReportBreak;

12.13.12. Resolve breaks of the report #

Resolve all breaks of the report. It may be useful to create a custom report executor. The equivalent C function is used internally. Used by unit tests.

public final
OpenCReport\Report::resolve_breaks(): void;

12.13.13. Get the current row number of the main query #

Get the current row number of the report's main query. Used by unit tests.

public final
OpenCReport\Report::get_query_rownum(): long;

12.13.14. Add a "report start" callback #

Add a "report start" callback to the report. The callback is called when the report starts during report execution.

public final
OpenCReport\Report::add_start_cb(
                     string $callback): void;

The callback function interface must follow this:

function
my_callback(OpenCReport $o, OpenCReport\Report $r): void;

12.13.15. Add a "report done" callback #

Add a "report done" callback to the report. The callback is called when the report is done during report execution.

public final
OpenCReport\Report::add_done_cb(
                     string $callback): void;

The callback function interface must follow this:

function
my_callback(OpenCReport $o, OpenCReport\Report $r): void;

12.13.16. Add a "new row" callback #

Add a "new row" callback to the report. The callback is called for every data row for the report during report execution.

public final
OpenCReport\Report::add_new_row_cb(
                     string $callback): void;

The callback function interface must follow this:

function
my_callback(OpenCReport $o, OpenCReport\Report $r): void;

12.13.17. Add an "iteration done" callback #

Add an "iteration done" callback to the report. The callback is called after every iteration for the report during report execution.

public final
OpenCReport\Report::add_iteration_cb(
                     string $callback): void;

The callback function interface must follow this:

function
my_callback(OpenCReport $o, OpenCReport\Report $r): void;

12.13.18. Add a "precalculation done" callback #

Add a "precalculation done" callback to the report. The callback is called after precalculation is done for the report during report execution.

public final
OpenCReport\Report::add_precalculation_done_cb(
                     string $callback): void;

The callback function interface must follow this:

function
my_callback(OpenCReport $o, OpenCReport\Report $r): void;

12.13.19. Check whether two report objects are the same #

Check whether the main object's internal C representation is the same as the passed-in object's internal representation.

public final
OpenCReport\Report::equals(
                     OpenCReport\Report $report):
                     bool;

12.13.20. Set the report's main query #

Set the report's main query to the passed-in OpenCReport\Query.

public final
OpenCReport\Report::set_main_query(
                     OpenCReport\Query $query): void;

12.13.21. Set the report's main query by name #

Set the report's main query using the query name.

public final
OpenCReport\Report::set_main_query_by_name(
                     string $query_name): void;

12.13.22. Set or get the report suppression #

Set the report's suppression. The expression must evaluate too a numeric value. It's zero or non-zero value will decide whether the report is suppressed, i.e. not calculated and not rendered in the output.

public final
OpenCReport\Report::public final set_suppress(
                     ?string $expr_string = null):
                     ?OpenCReport\Expr;

public final
OpenCReport\Report::public final get_suppress():
                     ?OpenCReport\Expr;

12.13.23. Set or get number of iterations for the report #

Set the number of iterations for the report. The report will be calculated and rendered this many times. Default is 1.

public final
OpenCReport\Report::set_iterations(
                     ?string $expr_string = null):
                     ?OpenCReport\Expr;

public final
OpenCReport\Report::get_iterations():
                     ?OpenCReport\Expr;

12.13.24. Set or get the font name for the report #

Set the font name for the report. The report font name will be used for any child elements that don't specify the font name themselves.

public final
OpenCReport\Report::set_font_name(
                     ?string $expr_string = null):
                     ?OpenCReport\Expr;

public final
OpenCReport\Report::get_font_name():
                     ?OpenCReport\Expr;

12.13.25. Set or get the font size for the report #

Set the font size for the report. The report font size will be used for any child elements that don't specify the font size themselves.

public final
OpenCReport\Report::set_font_size(
                     ?string $expr_string = null):
                     ?OpenCReport\Expr;

public final
OpenCReport\Report::get_font_size():
                     ?OpenCReport\Expr;

12.13.26. Set or get the report height #

Set the report height. During report execution, the report height is calculated for rendering. Height of lines that would be rendered are added. New lines that would exceed the report height are not rendered. The data shown in rendered lines are identical in both cased, whether or not the report height is set. Default is unset, i.e. every line is rendered and the number of lines determine the report height,

public final
OpenCReport\Report::set_height(
                     ?string $expr_string = null):
                     ?OpenCReport\Expr;

public final
OpenCReport\Report::get_height():
                     ?OpenCReport\Expr;

12.13.27. Set or get the report's field header prioroty #

Set the report's field header priority. See Report field header priority attribute for explanation.

public final
OpenCReport\Report::set_fieldheader_priority(
                     ?string $expr_string = null):
                     ?OpenCReport\Expr;

public final
OpenCReport\Report::get_fieldheader_priority():
                     ?OpenCReport\Expr;

12.13.28. Get output sections of the report #

Get the output sections of the report. See NoData node, Report header, Report footer and Detail node. For class methods of , see Section 12.16.

public final
OpenCReport\Report::nodata(): OpenCReport\Output;

public final
OpenCReport\Report::header(): OpenCReport\Output;

public final
OpenCReport\Report::footer(): OpenCReport\Output;

public final
OpenCReport\Report::field_header(): OpenCReport\Output;

public final
OpenCReport\Report::field_details(): OpenCReport\Output;