add_relationship
add_relationship
add_relationship(string $parent_table, string $primary_key, string $child_table, string $forign_key)
Parameter | Description |
---|---|
$parent_table | The parent table. For example "Orders" |
$primary_key | The primary key of the parent table. For example "ID" |
$child_table | The child table. For example "Order_details". |
$forign_key | The forign key in the child table. for example "order_id" |
$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();