KoolReport's Forum

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

Use raw query in dashboard and got warning message #1873

Open Robert Loar opened this topic on on Jan 26, 2021 - 2 comments

Robert Loar commented on Jan 26, 2021

I get error

Message: Non-static method koolreport\dashboard\sources\PDOSource::raw() should not be called statically 

When trying to use a raw query in the dashboard I'm receiving this error when trying to query a MSSQL database

This is how I'm using it

CircSrc::Raw("Select * FROM vt_TotalCircsbyMonth
        PIVOT
            (SUM(TotalCircs)
            FOR YearNum IN ([2021], [2020], [2019], [2018])
            )AS pvt ORDER BY month(NameofMonth  + ' 1 2014')");

When I change it to this

(new CircSrc)->Raw("Select * FROM vt_TotalCircsbyMonth
        PIVOT
            (SUM(TotalCircs)
            FOR YearNum IN ([2021], [2020], [2019], [2018])
            )AS pvt ORDER BY month(NameofMonth  + ' 1 2014')");

I get an error about not having a table.

Can you explain how using the dashboard I can run a run a raw query

KoolReport commented on Jan 26, 2021

You try this to see if it works:

CircSrc::rawSQL("...")
Robert Loar commented on Jan 26, 2021

Perfect...Thanks

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
None yet

None