set_sql

 
          set_sql(string $sql)  
If you are creating a SQL-based report, you need to call this method to define the SQL query you want to use for your report. Please note that the data source is defined when calling the 'ReportOptions' class constructor, where there is only two available options table-based data source "SRE_Table" and SQL-based data source "SRE_SQL"
# This method is exclusive to the commercial edition and is not supported in the community edition .

# Note

SQL-based data source should be used if you want to convert some SQL queries to professional reports.

# Parameters

Parameter Description
$sqlThe SQL select query, which you want to use as the data source of your report.

# Returns

This method returns the calling object, so it can be chained with other methods in the ‘ReportOptions’ class

# Code Example

 
           $report = new ReportOptions(SRE_PUBLIC_REPORT, SRE_SQL,"SQL_01");
$report->set_sql("select * from items where `Units_In_Stock` < 15 ")
       ->set_header("Header goes here")
       ->set_footer("Footer goes here")
       ->set_grouping(array("country"))     
       ->select_all_fields();
$engine = new CustomEngine($report);
$report_path = $engine->create_report();