I tryed to filter with ztable
ztable1.filter := 'CONAME="teste"';
ztable1.Filtered := true;
it shows nothing .
Do anyone know why?
I been reading the source and found only MasterLink filter on
procedure filterrow on zabstractRODataset unit.
Does ztable filter only linked tables (Master/Detail)????
I almost sure the client dataset is better then a zquery, the clientdataset a provider to filter( this one only ask to ztable (already local) the data once and filter it alone on is memory datacopy) i supose the clientdatset is better but ...
Does the zquery " *teste*" works ? - suppose so ?
Any better ideia ???
ztable filter error.
Moderators: gto, cipto_kh, EgonHugeist
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
We need some more details to solve the filter issue. How's the table structure?
Some more beginner advise :
- usually SQL filters (select ... from ... where <filter>) are more efficient, unless you want to allow the user to select them on an already opened full dataset.
- in case you don't want to show all rows and all fields of a table you should use a zquery to limit the amount of raw data returned from the database server.
I'm not really comfortable with clientdatasets, but if I understand the concept correctly you'll always need a tzquery or similar dataset component to feed data to the provider component.
Mark
Some more beginner advise :
- usually SQL filters (select ... from ... where <filter>) are more efficient, unless you want to allow the user to select them on an already opened full dataset.
- in case you don't want to show all rows and all fields of a table you should use a zquery to limit the amount of raw data returned from the database server.
I'm not really comfortable with clientdatasets, but if I understand the concept correctly you'll always need a tzquery or similar dataset component to feed data to the provider component.
Mark
THE REAL problem is the command 1 didnt work on ( ztable filter ).
So i think it doesnt filter at all except the (master/detail) (went to code see)
COMMAND 1 : ( doesnt work )
{
ztable1.filter := 'CONAME="teste"';
ztable1.Filtered := true;
}
What i wanna do is for Example :
CONAME ="*teste*" didnt work on a Ttable, Tclientdataset ...
so if it doesnt work on ztable is ok.
But this does work on a client dataset etc :
CONAME ="teste*" or CONAME ="teste"
What i did to work :
{
It worked with client data set and a ztable is fine (whould be better filter directly on ztable ).
I get all the "clients list" table (ztable) then i filter it with a clientdataset connected to a provider and the provider to the ztable.
}
Can you garantie me im not wrong to make sure i dont use (extra Clientdatasets without need).
If ztable dont filter there is other way to filter :
To check in any pos if text "teste" exist any where on string like "*teste*" with caseinsensitive do :
You can change the onfilterrecord from dataset datalink
procedure comp.onfilterrecord(dataset:tdataset:var accept:boolean);
begin
accept := pos(Ansiuppercase('teste' {the supposed "*teste*"}),ansiuppercase(field.asstring) {data base string} )>0;
end;
Did it on clientdataset, works fine, while i press keys to filter and shows record that contains "teste" anywhere.
Hope this, help a bit. ( Didt change any zeus code i want the original is better )
Sorry for the throuble.
Thanks.
So i think it doesnt filter at all except the (master/detail) (went to code see)
COMMAND 1 : ( doesnt work )
{
ztable1.filter := 'CONAME="teste"';
ztable1.Filtered := true;
}
What i wanna do is for Example :
CONAME ="*teste*" didnt work on a Ttable, Tclientdataset ...
so if it doesnt work on ztable is ok.
But this does work on a client dataset etc :
CONAME ="teste*" or CONAME ="teste"
What i did to work :
{
It worked with client data set and a ztable is fine (whould be better filter directly on ztable ).
I get all the "clients list" table (ztable) then i filter it with a clientdataset connected to a provider and the provider to the ztable.
}
Can you garantie me im not wrong to make sure i dont use (extra Clientdatasets without need).
If ztable dont filter there is other way to filter :
To check in any pos if text "teste" exist any where on string like "*teste*" with caseinsensitive do :
You can change the onfilterrecord from dataset datalink
procedure comp.onfilterrecord(dataset:tdataset:var accept:boolean);
begin
accept := pos(Ansiuppercase('teste' {the supposed "*teste*"}),ansiuppercase(field.asstring) {data base string} )>0;
end;
Did it on clientdataset, works fine, while i press keys to filter and shows record that contains "teste" anywhere.
Hope this, help a bit. ( Didt change any zeus code i want the original is better )
Sorry for the throuble.
Thanks.
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Please check if TZAbstractRODataset.FilterRow function is executed when using a TZTable component. It *should*. Then check what happens with this part at the end of this function:
Mark
Code: Select all
{ Check the record by filter expression. }
if FilterEnabled and (FilterExpression.Expression <> '') then
begin
if not InitFilterFields then
begin
FilterFieldRefs := DefineFilterFields(Self, FilterExpression);
InitFilterFields := True;
end;
CopyDataFieldsToVars(FilterFieldRefs, ResultSet,
FilterExpression.DefaultVariables);
Result := FilterExpression.VariantManager.GetAsBoolean(
FilterExpression.Evaluate4(FilterExpression.DefaultVariables,
FilterExpression.DefaultFunctions, FilterStack));
end;