Recordset_Selecting filter does not apply to Chart

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
yinsw
User
Posts: 148
Location: Penang, Malaysia

Recordset_Selecting filter does not apply to Chart

Post by yinsw »

PHPMaker v2024.9
DB: MSSQL 2017

I put the following code in Recordset_Selecting:

function Recordset_Selecting(&$filter)
{
    // Enter your code here
	$filter = str_replace('[TransactionDatetime]',   'convert(varchar(10),[TransactionDatetime],120)',   $filter);
}

The TransactionDatetime search operator is set to "BETWEEN". In debug mode, I can see the filter is applied to the report but not to the chart query.

Meaning to say, I can see data in the List page, but the chart is not shown because the query for the chart is empty (because the filter was not applied to it)


arbei
User
Posts: 9384

Post by arbei »

Recordset_Selecting is not for reports. For reports, you may try Page_Selecting.


yinsw
User
Posts: 148
Location: Penang, Malaysia

Post by yinsw »

This is not a report, so there is no Page_Selecting event.

This is normal table, where you can add chart in the Chart tab so the generated script will show both the Chart and the data


arbei
User
Posts: 9384

Post by arbei »

Then you may try set your filter to $this->Filter of the page for the chart to get. Note that $this->Filter is a page property, it is not same as the $filter (argument of Recordset_Selecting) in your first post. You may try Recordset_Selecting and set $this->Filter = $filter.


yinsw
User
Posts: 148
Location: Penang, Malaysia

Post by yinsw »

I didn't change anything. It is fixed now debug shows the query result is now same for both the data and chart.


Post Reply