Article View: comp.lang.pascal.delphi.misc
Article #93Re: Problem with partial search. Please help me!!!!
From: David M. Goncalves
Date: Tue, 21 Jul 1998 00:00
Date: Tue, 21 Jul 1998 00:00
56 lines
2660 bytes
2660 bytes
Your example shows keyfield count as ONE. Could that be your problem?
You are searching on 2 fields, no? I suspect keyfieldcount will not work
anyway, because Delphi is stupid when it comes to expression indexes.
It doesn't know which fields are in the expression, or probably how many
fields are in it.
Furthermore, I don't know what "TTable.IndexKey" is. I use dBASE
expression indexes all the time, and have never encountered that.
IndexName, yes.
Try this, instead:
with mytable do
begin
Setkey;
Fieldbyname('FIELD1').asstring:=key1;
Fieldbyname('FIELD2').asstring:=key2;
Fieldbyname('FIELD3').asstring:='';
Gotonearest;
if (Fieldbyname('FIELD1').asstring<>key1)
and (Fieldbyname('FIELD2').asstring<>key2)
then showmessage ('BARF!');
end;
PLUS, remember that your keys will be case-sensitive, unless your
expression specifies otherwise, with the UPPER function! This could be
your problem, too...
Let me know how it goes...
DMGoncalves
Gabriele Cardinali wrote:
>
> Please, help me!!!!
> I have a DBF table with some fields. I have created an expression index
> in this way:
> myTable.AddIndex('myIndex','Field1+Field2+dtos(Field3)',[ixExpression,
> ixDescending])
>
> I have to do a partial search on Field1 and Field2.
> So I do the following:
>
> myTable.IndexKey:='myIndex';
> myTable.SetKey;
> myTable.KeyfieldCount:=1; { to use Field1 and Field2 }
> myTable.FieldByName('Field1').AsString:='aaaaaa';
> myTable.FieldByName('Field2').AsString:='bbbbb';
> myTable.GotoKey;
>
> but this source doesn't work. I have tried also with GotoNearest.
> Partial search doesn't work with expression indexes???
> Please, tell me not!!!!!!!!!!
> Please help me and, however, thanks for your interesting.
> Thanks once again.
Technical Details
Message-ID:
<35B4D85D.7C72@vicon.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<35B4B2BD.C56ADA46@febea.it>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: ff75c,8c8e8a36b517982f X-Google-Attributes: gidff75c,public X-Google-Thread: 10baee,8c8e8a36b517982f X-Google-Attributes: gid10baee,public X-Google-Thread: f6386,8c8e8a36b517982f X-Google-Attributes: gidf6386,public From: "David M. Goncalves" <dmgoncal@vicon.net> Subject: Re: Problem with partial search. Please help me!!!! Date: 1998/07/21 Message-ID: <35B4D85D.7C72@vicon.net> X-Deja-AN: 373607411 Content-Transfer-Encoding: 7bit References: <35B4B2BD.C56ADA46@febea.it> To: Gabriele Cardinali <febeaweb@febea.it> Content-Type: text/plain; charset=us-ascii Organization: Scanlon Associates MIME-Version: 1.0 Reply-To: dmgoncal@vicon.net Newsgroups: comp.lang.pascal.delphi.misc,borland.public.delphi.database.multi-tier,borland.public.delphi.database.desktop