Unknow symbol "." in filter

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

Locked
woolfik
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 29.06.2009, 09:37

Unknow symbol "." in filter

Post 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
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
woolfik
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 29.06.2009, 09:37

Post 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 :)
btray77
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 30.04.2010, 19:44

Post 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.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
Locked