Filter a Summary Report

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
latolap
User
Posts: 85

Filter a Summary Report

Post by latolap »

Hi, i'm trying to filter a summary report for CurrentUserID() if the CurrentUserLevel() is 2 and disable the ext. search for the userid. The field utente_tempo is my userid field, and it's a dropdown with all my users. I've tried with two metods:

1) In Fields->Report(Extended Search) -> Default Value i've inserted CurrentUserID()
In Page_load:

if (CurrentUserLevel() == 2) {
    $this->utente_tempo->Disabled = true;
}

2) In Page_load:

if (CurrentUserLevel() == 2) {
    $this->utente_tempo->Disabled = true;
}

In Page_Selecting:

AddFilter($filter, "utente_tempo = '".CurrentUserID().'");

this will disable correctly the utente_tempo field in ext. search but give me an empty table.
If i use:

AddFilter($filter, "utente_tempo = 1");

It's working fine.
Any idea why CurrentUserID() is not working?


mobhar
User
Posts: 11660

Post by mobhar »

Try:

AddFilter($filter, "utente_tempo = " . CurrentUserID());

latolap
User
Posts: 85

Post by latolap »

it gives me a sintax error near " ) ", looks like it's trying to search for " CurrentUserID() " and not for the user id value.

/var/www/html/test/vendor/doctrine/dbal/src/Driver/API/SQLSrv/ExceptionConverter.php(33): An exception occurred while executing a query: SQLSTATE [42000, 102]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Sintassi non corretta in prossimità di ')'. SQLSTATE [42000, 8180]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Impossibile preparare le istruzioni.

arbei
User
Posts: 9284

Post by arbei »

You probably have wrong syntax in the SQL due to your added filter. (You should check if CurrentUserID() has value first or the filter may be incomplete if it does not have value.) You may also turn on Debug and check the log file for the wrong SQL.


Post Reply