KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Dashboard AutoMaker: how to union multi query #1790

Open developer opened this topic on on Dec 24, 2020 - 1 comments

developer commented on Dec 24, 2020
$first = AutoMaker::table("fields")->select('field_name')->run;
        return AutoMaker::table("transactions")
                ->join('routes')
                ->selectRaw('routes.route_name,routes.route_no, 
                    sum(transactions.net_amount) as net_amount, 
                    sum(transactions.vat_amount) as vat_amount, 
                    sum(transactions.discount) as discount, 
                    sum(transactions.total_amount) total, 
                    sum(transactions.max_factor_qty) qty
                ')
                ->where('transactions.status', 3)
                ->where('transactions.transaction_type', '!=',2)
                ->orderBy('total','desc')
                ->groupBy('route_id')
                ->union($first)
                ->run();

when I run this query getting Message: Undefined property: koolreport\core\DataStore::$type Line: 344 File: demo3\vendor\koolreport\querybuilder\SQL.php

so how could I solve this? any help, please

KoolReport commented on Dec 24, 2020

Hi,

The simplest way you can do is to use rawSQL() like this:

return AutoMaker::rawSQL("
    any of your query including union
");

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
solved

None