This topic is locked

Limit data displayed in detail chart

3/1/2019 8:26:24 AM
PHPRunner General questions
W
wpl author

Hello listers,
I would like to limit the data displayed in a chart when the chart is a detail of a table (using PHP Runner 9.8, latest build).

I thought it could be done analogous to the procedure when displaying a table as a detail, which works with this code in "AfterTableInit":



if(isset($_POST["mode"]) && $_POST["mode"] === "listdetails")

{

$query->addWhere("year=2012");

}


This does, however, not work when displaying a chart as a detail to a table. It does work when adding this code:



$query->addWhere("year=2012");


But, the chart will then be limited always.
Thanks for any hint

M
Mark Kramer 3/1/2019



Hello listers,
I would like to limit the data displayed in a chart when the chart is a detail of a table (using PHP Runner 9.8, latest build).

I thought it could be done analogous to the procedure when displaying a table as a detail, which works with this code in "AfterTableInit":



if(isset($_POST["mode"]) && $_POST["mode"] === "listdetails")

{

$query->addWhere("year=2012");

}


This does, however, not work when displaying a chart as a detail to a table. It does work when adding this code:


$query->addWhere("year=2012");


But, the chart will then be limited always.
Thanks for any hint


In my case I use define a "session variable" in the After successful login. $_SESSION["your_var"] = $data[your_var];
Then on each page I want "query" in the "After table Initialized" I add $query->addWhere("your_var like '%".$_SESSION["your_var"] ."%'");

W
wpl author 3/1/2019



In my case I use define a "session variable" in the After successful login. $_SESSION["your_var"] = $data[your_var];
Then on each page I want "query" in the "After table Initialized" I add $query->addWhere("your_var like '%".$_SESSION["your_var"] ."%'");



Mark,
thanks for joining. What I meant is that addQuery is working with a table but not with a chart when both are embedded as detail in a list page.
Regards

Sergey Kornilov admin 3/1/2019

My guess is that with charts $_POST["mode"] is "listdetails". Chart data is produced by file dchartdata.php (you can find more details inspecting Network tab in Chrome).
The easiest solution here is to create a copy of the chart and only use it in details mode. This way you can use a hardcoded statement $query->addWhere("year=2012"); to limit data.

W
wpl author 3/2/2019



My guess is that with charts $_POST["mode"] is "listdetails". Chart data is produced by file dchartdata.php (you can find more details inspecting Network tab in Chrome).
The easiest solution here is to create a copy of the chart and only use it in details mode. This way you can use a hardcoded statement $query->addWhere("year=2012"); to limit data.


admin,
thanks for your input. Making a copy of the chart would have been my next shot. I saw in Firefox debug tools that dchartdata.php actually is fetching the data but didn't delve into it too far.
Regards