Page 1 of 1

Recordset_Selecting filter does not apply to Chart

Posted: Thu Mar 07, 2024 12:03 am
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)


Re: Recordset_Selecting filter does not apply to Chart

Posted: Thu Mar 07, 2024 10:15 am
by arbei

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


Re: Recordset_Selecting filter does not apply to Chart

Posted: Thu Mar 07, 2024 4:42 pm
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


Re: Recordset_Selecting filter does not apply to Chart

Posted: Thu Mar 07, 2024 5:12 pm
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.


Re: Recordset_Selecting filter does not apply to Chart

Posted: Sat Mar 09, 2024 10:22 pm
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.