__construct
__construct
__construct($access_mode =Constants::SRE_PRIVATE_REPORT , $data_source = Constants::SRE_Table, $report_name =
Parameter | Description |
---|---|
$access_mode | A constant representing the access mode of the report. So, It could be either SRE_PUBLIC_REPORT Or SRE_PRIVATE_REPORT. If omitted, SRE_PRIVATE_REPORT will be used |
$data_source | A constant representing the data source of the generated report. So, it could be either SRE_Table (for table-based reports) or SRE_SQL (for SQL-based reports). If omitted, SRE_Table will be used. |
$report_name | The directory name of your generated report. And it should be a unique string identifying your report. If omitted, the engine will generate a unique directory name for your generated report. Please be aware that by default new reports shouldn't override existing reports with the same name unless you set the 'SRE__Auto__Replace__Reports__' in the config file to 1 |
Error NO | Error Message | Description |
---|---|---|
56 | Subtotal function is invalid. | You are passing an unknown subtotals function. Supported functions are: SRE_SUM, SRE_AVERGAE, SRE_COUNT, SRE_MAX, or SRE_MIN. |
57 | Subtotal group by column is invalid. | Either you didn't call the set_grouping function while creating this report, or the group_by column passed to the sub_total function is not passed to the set_grouping function. |
58 | The affected columns of subtotal function must be | Make sure the "affected columns" are a valid array of existing columns without any spelling mistakes. |
try{
$report = new ReportOptions(SRE_PUBLIC_REPORT);
$report->select_tables(array("items"))
->set_grouping(array("country"))
->select_all_fields();
$engine = new CustomEngine($report);
$report_path = $engine->create_report();
echo "Your report URL:" . $report_path;
} catch (Exception $ex) {
echo 'Caught exception message: '. $ex->getMessage();
}