Page 1 of 1

Filter a Summary Report

Posted: Thu Jun 08, 2023 5:47 pm
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?


Re: Filter a Summary Report

Posted: Thu Jun 08, 2023 6:19 pm
by mobhar

Try:

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

Re: Filter a Summary Report

Posted: Thu Jun 08, 2023 6:30 pm
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.

Re: Filter a Summary Report

Posted: Thu Jun 08, 2023 7:04 pm
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.