KoolReport's Forum

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

Dashboard: How to use rawSQL with parameters #2617

Open IEK AKMH opened this topic on on Mar 22, 2022 - 2 comments

IEK AKMH commented on Mar 22, 2022

I am trying to use the below rawSQL query. Can you please assist me on how to pass the :UserId parameter. protected function dataSource()

{
    return dbDashboard::rawSQL("
      SELECT *
      FROM SQLSERVER_Table
        WHERE IDSec = :UserId
    ");

I have tried to pass the parameter on chart creation, but it doesn't seem to work LineChart::create()->params([ "UserId"=>$_SESSION["login_id"] ]),

IEK AKMH commented on Mar 22, 2022

I used str_replace before passing the query text to the rawSQL function. Is there a more delicate method to achieve the requested functionality or this is the only way I can do it;

KoolReport commented on Mar 28, 2022

Right now, the possible solution for raw query is your solution, using the str_replace. I will forward your issue to dev.team if they have any future solution.

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
help needed

Dashboard