create_report
create_report
create_report()
Error NO | Error Message | Description |
---|---|---|
1 | Could not create the report directory. Permission | This exception occurs due to permission error. You need to make sure you give 755 permissions to the "/sre_reports" in the case of native applications or "/public/sre_reports" in the case of laravel applications. |
2 | Could not write in the 'init.php' configuration fi | This exception occurs due to permission error. You need to make sure you give 755 permissions to the "/sre_reports" in the case of native applications or "/public/sre_reports" in the case of laravel applications. |
16 | No tables were selected for the report! | You need to call the "select_tables" method using the "ReportOptions" instance you created. |
15 | No columns were selected for the report | You need to call the "select_fields" or the"select_all_fields" method using the "ReportOptions" instance you created. |
17 | The datasource is set to SQL yet a SQL query is no | You need to call the "set_sql" method using the instance of the "ReportOptions" which you created. |
18 | The data source is not recognized! | You need to pass either SRE_Table or SRE_SQL (Constants::SRE_Table or Constants::SRE_SQL in case of laravel applications) as the second parameter to the constructor of the "ReportOptions" class. |
19 | Connection parameters are missing! | You need to set default connection parameters in the configuration file of SmartReportEngine, which you can find at "sre_config/config.php" in the case of native PHP applications or "sre/SmartReportingEngine/src/Configs.php" in the case of laravel applications. |
44 | The 'security_init()' should be called before any | When creating private reports, you should call "security_init" method using the "ReportOptions" instance which you are using to initialize the security settings of your report such as used session name, login, and logout pages. |
50 | The access mode of the report is private, yet no s | When creating a private report, you should call one or more of the "security_check_session_" methods to define all the session validations needed for your private report. |
51 | The access mode of report is public, yet some sess | No session validations can be done for public reports which meant to be accessed by everyone without any session validations. |
55 | The access mode of report is public, yet the 'sec | No session validations can be done for public reports which meant to be accessed by everyone without any session validations. So you need to call the "security_init" method for private reports only! |
52 | The access mode of report is private yet the login | You need to set a default login page in the configuration file of SmartReportEngine, which you can find at "sre_config/config.php" in the case of native PHP applications or "sre/SmartReportingEngine/src/Configs.php" in the case of laravel applications. |
53 | The access mode of report is private yet the logou | You need to set a default logout page in the configuration file of SmartReportEngine, which you can find at "sre_config/config.php" in the case of native PHP applications or "sre/SmartReportingEngine/src/Configs.php" in the case of laravel applications. |
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(). "\n";
echo 'Caught exception code: '.$ex->getCode(). "\n";
echo 'Caught exception Trace:'. $ex->getTraceAsString() . "\n";
}