__construct

 
          __construct($access_mode =Constants::SRE_PRIVATE_REPORT , $data_source = Constants::SRE_Table, $report_name =   
This method is the class constructor, it's called when an instance of the 'ReportOptions' class is created! Additionally, it initializes the new instance with the access mode of the report, the data source, and the report name.
# This method is available in both the community edition and the commercial edition .

# Note

In case of native projects, constants should be passed directory (i.e SRE_PRIVATE_REPORT), but in case of Laravel project constants should be passed as static members of the constants class (i.e Constants::SRE_PRIVATE_REPORT)

# Parameters

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_nameThe 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

# Exceptions

Error NO Error Message Description
56Subtotal function is invalid.You are passing an unknown subtotals function. Supported functions are: SRE_SUM, SRE_AVERGAE, SRE_COUNT, SRE_MAX, or SRE_MIN.
57Subtotal 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.
58The affected columns of subtotal function must be Make sure the "affected columns" are a valid array of existing columns without any spelling mistakes.

# Code Example

 
           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();
}