add_relationship

 
          add_relationship(string $parent_table, string  $primary_key, string  $child_table, string $forign_key)              
This method defines the relationship between any two tables. Therefore, It should be used for reports that are based on multiple tables.
# This method is exclusive to the commercial edition and is not supported in the community edition .

# Parameters

Parameter Description
$parent_tableThe parent table. For example "Orders"
$primary_keyThe primary key of the parent table. For example "ID"
$child_tableThe child table. For example "Order_details".
$forign_keyThe forign key in the child table. for example "order_id"

# 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);
$report->select_tables(array("items", "items_sales"))
       ->add_relationship("items", "id", "items_sales", "item_id")
       ->set_grouping(array("items.country"))
       ->sort_by("items.id")
       ->set_language("fr")
       ->set_style_name("grey")
       ->select_fields(array("items.id","items.product_code","items.country","items_sales.customer_name" ,"items.product_name","items.list_price","items.units_in_stock"))       
       ->label("items_sales.customer_name","Country");
$engine = new CustomEngine($report);
$report_path = $engine->create_report();