sort_by

 
          sort_by(string $column, int $order = 0)  
This method is used for sorting the report that you want to generate by any given column in it. This can be done either in an ascending or descending order based on the value of the order parameter, which if omitted, the ascending order will be used.
# This method is available in both the community edition and the commercial edition .

# Note

If you want to sort your report by multiple columns, you will have to call this method multiple times (once per each sorting column)

# Parameters

Parameter Description
$columnThe column by which you want to sort the generated report.
$orderThis parameter can be 0 or 1. If you set it to 1 your generated report will be sorted in a descending order. Otherwise, it will be sorted in an ascending order.

# Returns

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

# Code Example

 
             $report = new ReportOptions(Constants::SRE_PUBLIC_REPORT);
        $report->select_tables(array("items", "items_sales"))
               ->add_relationship("items", "id", "items_sales", "item_id")
               ->set_grouping(array("items.country"))
               ->sort_by("items.iD")
               ->select_fields(array("items.id","items.product_code","items.country","items_sales.customer_name" ,"items.product_name","items.list_price","items.units_in_stock"));               
        $engine = new CustomEngine($report);
        $report_path = $engine->create_report();