Hello to EveryOne
How can make a filter condition on TDatabase Class?
Any help would be apreciate.
Many Thanks
Regards
Dionisis
Hello to EveryOne
How can make a filter condition on TDatabase Class?
Any help would be apreciate.
Many Thanks
Regards
Dionisis
Dionisis,
You may implement and try this new Class TDataBase Method SetFilter():
METHOD SetFilter( bCondition, cCondition ) INLINE If( bCondition != nil, ( ::nArea )->dbSetFilter( bCondition, cCondition ), ( ::nArea )->dbClearFilter() )
Example:
oDbf:SetFilter( { || oDbf:Load(), oDbf:Age > 20 }, "Age > 20" )
Hello Antonio
Unfortunately this new method dosen't Works. I get a compiler error
Parse Error At ( (shownig the (::nArea)->)
Any Suggestion to overcome this ?
Compiler xHarbour Commercial October 2005 release
FWH 2.7
Many Thanks
Dionisis
Dionisis,
Ops, my mistake, sorry
This should be the right code:
METHOD SetFilter( bCondition, cCondition ) INLINE If( bCondition != nil, ( ::nArea )->( dbSetFilter( bCondition, cCondition ) ), ( ::nArea )->( dbClearFilter() ) )
odbINSTALL:SetFilter({||Month(odbInstall:MDAY)=Month(Date())},;
"Month(odbInstall:Mday)=Month(Date())")
MsgInfo (STR(odbInstall:Reccount())+" Records Fouds")odbINSTALL:SetFilter({||odbINSTALL:Load(), Month(odbInstall:MDAY)=Month(Date())},;
"Month(odbInstall:Mday)=Month(Date())")
MsgInfo (STR(odbInstall:Reccount())+" Records Fouds")Antonio
This method works but it is usefull with Browsers and not to namipulate directly the aBuffer or to count the length of a filetered database.
What i mean is that after applying the method SetFilter(). The lenght of database not varies. I get the same Reccout() with or without the SetFilter() method. Nothing happens the only defference i noticed is when i call the Browse() function it displays the correct portion of filtered database.
Those are my observations for the SetFilter() method. I giveup and look for another approach.I know that is difficult but i hope to deal with this difficult situation.
Regards and goodnight
Dionisis
Dionisis,
You should use a temporary index created with a FOR clause. Its the best way.