Page 1 of 1

Unknow symbol "." in filter

Posted: 01.10.2009, 10:16
by woolfik
Hello I have next error

I have an sql query like this:

SELECT DISTINCT

us.idx_osoby,
us.imie,
us.nazwisko,
us.login,
dz.nazwa as "nazwa_dzialu",
bl.blokada,
bl.idx_device,
ur.nazwa,
ds.idx_strefy1,
ds.idx_strefy2,
ds.idx_strefy3

FROM public.users as us

LEFT JOIN public.dzialy as dz on us.idx_dzialu = dz.idx_dzialu
LEFT JOIN kd.blokowanie as bl on us.idx_osoby = bl.idx_osoby
LEFT JOIN kd.dostep_userow as ds on us.idx_osoby = ds.idx_osoby
LEFT JOIN dev.urzadzenia as ur on bl.idx_device = ur.idx_device

WHERE (us.aktywny = TRUE) and (bl.idx_device = 23) and (bl.blokada = TRUE)

ORDER by us.idx_osoby;

And it's working but I whant to add some filter on this query looking like this:

qrUsers.Filter := (us.aktywny = TRUE) and (bl.idx_device = 23) and (bl.blokada = TRUE) and in SQL it is working but in zeos I have an error like in subject.

I have looking for this error in code and In:

const
{** Defines a list of operators. }
OperatorTokens is no '.' operator I don't know is that a mistake or it should be like this but I have no idea how can I doing my filtering

Posted: 01.10.2009, 13:27
by mdaems
Use the field names as they are returned by the query. This means you can't filter by aktywny.

Filters are executed locally and not added to the sql sent to the server. This also means the same amount of data will be retrieved from the server.

When multiple columns have the same name there's automatic naming, depending on the server. So it's always safer to use aliases for these column names. You never know how this automatic naming behavior changes over time.


Mark

Posted: 02.10.2009, 07:58
by woolfik
Mark thank you very much when I set alias on aktywny as akt and filtering on akt = true it is working ok. Beer for you :)

Posted: 13.05.2010, 13:19
by btray77
can you go into more detail on what you did.. I'm not familiar with setting aliases, and this just might be the solution to my problem.

Posted: 16.05.2010, 20:44
by mdaems
btray77,

It's about specifying the column names to be returned by the database server in the query. Eg. 'select 1 as column1 from dual' makes sure the column returned by the server is named 'column1' in the dataset instead of some randomly generated name.
That way you know in advance which column name can be used inside the filter property of the ZQuery component, because this filter is not passed on to the database but processed inside the zeoslib based client program. So the filter works on column names as seen by the dataset.

Mark