Page 1 of 1

zquery.datasource what is it? how to use it?

Posted: 12.04.2022, 00:03
by hamacker
Still studing zeoslib, now zquery.
I would like a help, I am not understanding datasource property in zquery component.
To me I can reference a field in another dataset and maybe in another connection, but I can't find any doc about.
I know that is not for use master/detail 'cause I have masterdatasource property to do that.
So, someone can help me?
What is zquery.datasource and how to use it?

Re: zquery.datasource what is it? how to use it?

Posted: 12.04.2022, 09:42
by miab3
DataSource in ZQuery(detail) is used to link master-detail using SQL(in detail) "select * from tdetail where Field1_tdetail =:Field2_tmaster"
And it generates the appropriate query every time the position of the master cursor changes.

MasterSource works in conjunction with MasterFields and Linked Fields and ZTable or ZQuery(in detail) using SQL "select * from tdetail".
And it works on downloading all data to the client at once.
It can be said that it filters out detail every time the position of the master cursor changes.
It is a master-detail link on local data.

Michał

Re: zquery.datasource what is it? how to use it?

Posted: 13.04.2022, 01:01
by hamacker
I tried several times but it does not recognize fields on second datasource(detail).
There is a secret to use :field_datasource2?

Re: zquery.datasource what is it? how to use it?

Posted: 13.04.2022, 14:16
by miab3
It is a field name from the master table.
E.g.
ZQuery_master: tmaster - idm, valuem - select * from tmaster
ZQuery_detail: tdetail - idd, valued, idmd - select * from tdetail where idmd=:idm
ZQuery_detail.DataSource:=DataSource_master;

Michał

Re: zquery.datasource what is it? how to use it?

Posted: 19.04.2022, 16:53
by marsupilami
Note: This is also documented to some degree in chapter 2.6.1 (Master/Detail with server sided filters) of the Zeos documentation collection ;)

Server side filters meaning that the filter is applied on the server side before data is fetched to the client.