gerhard9121
asked on
Delphi 2009 Table findnext
Hi
Using Delphi 209, Titan and InfoPower. I doing the following at runtime:
Select a table from a list.
Select a index from a list.
Display a record from the table.
Change more than one of the key fields values.
Now the problem. I can't at runtime find the record nearest to the changed data.
The Locate only works if all he keys are completed correctly.
The FindNearest give a conversion error. How do I pass the Parameters of mix types to the procedure
Thanks
Using Delphi 209, Titan and InfoPower. I doing the following at runtime:
Select a table from a list.
Select a index from a list.
Display a record from the table.
Change more than one of the key fields values.
Now the problem. I can't at runtime find the record nearest to the changed data.
procedure TfrmDataInspector.bSearchClick(Sender: TObject);
var
LocateValues : Variant;
LocateFields: String;
I: Integer;
begin
LocateFields := tbTemp.IndexFieldNames;
LocateValues := VarArrayCreate([0, tbTemp.IndexFieldCount - 1],varVariant);
for i:= 0 to tbTemp.IndexFieldCount - 1 do
LocateValues[i]:= tbTemp.IndexFields[i].AsString;
if tbTemp.State <> dsBrowse then
tbTemp.Cancel;
if tbTemp.Locate(LocateFields,LocateValues,[loCaseInsensitive,loPartialKey]) then
ShowMessage('Found');
tbTemp.FindNearest([LocateValues]);
end;
The Locate only works if all he keys are completed correctly.
The FindNearest give a conversion error. How do I pass the Parameters of mix types to the procedure
Thanks
not really sure what your database type is.
query for finding a match or almost match:
select *
from tbTemp t
where
case when upper(column1) like upper(:value1) then '1' else '' end ||
case when upper(column2) like upper(:value2) then '1' else '' end ||
case when upper(column3) like upper(:value3) then '1' else '' end like '%1%';
|| is concatenation of string in oracle
query for finding a match or almost match:
select *
from tbTemp t
where
case when upper(column1) like upper(:value1) then '1' else '' end ||
case when upper(column2) like upper(:value2) then '1' else '' end ||
case when upper(column3) like upper(:value3) then '1' else '' end like '%1%';
|| is concatenation of string in oracle
ASKER
Sorry I did not mention but the data is stored in Btrieve (not pervasive) database. Don't think it caters for SQL query.
How does Infopower pass the Locate Values as a Array of Constant to there FindNearest procedure
How does Infopower pass the Locate Values as a Array of Constant to there FindNearest procedure
don't have any experience with Btrieve
Using Delphi 209, Titan and InfoPower
i new what Delphi2009 was for but i've no clue what Titan is
And InfoPower is just a hint of clue
any reference to Titan and InfoPower ?
and BTrieve (not Pervasive) ?
>> this would state differently
http://www.pervasivedb.com/btrieve/Pages/Default.aspx
Using Delphi 209, Titan and InfoPower
i new what Delphi2009 was for but i've no clue what Titan is
And InfoPower is just a hint of clue
any reference to Titan and InfoPower ?
and BTrieve (not Pervasive) ?
>> this would state differently
http://www.pervasivedb.com/btrieve/Pages/Default.aspx
can't even find BTrieve documentation without a login
> then again, they stopped BTrieve 16 years ago
> then again, they stopped BTrieve 16 years ago
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
difference between table and query:
using a table, all data is loaded into memory first, and then the search performed
using a query, the searchcriteria are specified in the sql text and only the matching dataset is returned across the network
(you don't need to index each search field)
it's more difficult if you don't want exact matches
but then again, what is a not so exact match ...