ClientDataSet Index Not Finding a '-' in an indexed field

ClientDataSet Index Not Finding a '-' in an indexed field

Post by Patric » Sat, 08 Jan 2005 20:09:39


In a Client Data Set, I hav a field: 'ItemDescr' that contains the data:
"500-12V WIDGET". When I do a FindKey (seek) on the input string: '500-1'
through an OnChange event, it ignores the '-', and finds the record: "5001".

How can I make the ClientDataSet index look for the '-' in the data
"500-12V"?

The Property Options for this CDS's index (ItemDescr) are:
ixPrimary := False
ixUnique := False
ixDescending := False
ixCaseInsensitive := True
ixExpression := False
ixNonMaintained := True

TIA--patrick
 
 
 

ClientDataSet Index Not Finding a '-' in an indexed field

Post by Bill Tod » Sat, 08 Jan 2005 23:10:39

Show us the code that fails. My guess is that you do not have the string
500-1 properly quoted.

--
Bill Todd (TeamB)
TeamB cannot answer questions received via email

 
 
 

ClientDataSet Index Not Finding a '-' in an indexed field

Post by Patric » Sun, 09 Jan 2005 09:50:41

Here's the code. The edit control's OnChange event calls FindByItemDesc:

procedure TfrmInventorySelectItems.findItemDescChange(Sender: TObject);
begin
FindByItemDesc(Sender);
end;

procedure TfrmInventorySelectItems.FindByItemDesc(Sender: TObject);
begin
dm.cds.IndexName := 'ITEM_DESC';
dm.cds.FindNearest([findItemDesc.Text]);
end;

TIA--patrick
 
 
 

ClientDataSet Index Not Finding a '-' in an indexed field

Post by Bill Tod » Sun, 09 Jan 2005 11:10:56

There is nothing wrong with your code. Have you set a breakpoint on the
call to FindNearest to make sure that findItemDesc.Text contains the dash?

--
Bill Todd (TeamB)
TeamB cannot answer questions received via email
 
 
 

ClientDataSet Index Not Finding a '-' in an indexed field

Post by Patric » Sun, 09 Jan 2005 20:27:52

Yes - I set a breakpoint on FindNearest, the dash is in the edit control

I modified the code - added the FindKey function:
--------------------
procedure TfrmInventorySelectItems.FindByItemDesc(Sender: TObject);
begin
dm.cds.IndexName := 'ITEM_DESC';

//dm.cds.FindNearest([findItemDesc.Text]);

if (not dm.cds.FindKey([findItemDesc.Text])) then
dm.cds.FindNearest([findItemDesc.Text]);
end;
--------------------
The if statement always passes (FindKey is False) when I input a valid
ItemDescr: '500'. Why would FindKey fail on a valid find?

The Property Options for this CDS's index (ItemDescr) are:
ixPrimary := False
ixUnique := False
ixDescending := False
ixCaseInsensitive := True
ixExpression := False
ixNonMaintained := True

--patrick
 
 
 

ClientDataSet Index Not Finding a '-' in an indexed field

Post by Bill Tod » Sun, 09 Jan 2005 23:39:06

I have never had FindKey fail on a CDS so I am not sure what is causing
your problem.

What version of Midas.dll are you using?

What version of Delphi are you using?

What database are you using?

What is the metadata of the table the CDS is getting its data from?

--
Bill Todd (TeamB)
TeamB cannot answer questions received via email
 
 
 

ClientDataSet Index Not Finding a '-' in an indexed field

Post by Patric » Mon, 10 Jan 2005 21:26:06

MIDAS.DLL date: 08/09/2002 08:00 AM
MIDAS.DLL size: 296,448
Delphi 7 Pro
Database: Clipper NTX, Advantage TAdsTable 6.2(ACE)

--patrick
 
 
 

ClientDataSet Index Not Finding a '-' in an indexed field

Post by Bill Tod » Mon, 10 Jan 2005 23:07:28

Install all of the D7 updates from the registered users area of Borland's
Web site. You are not even close to being current.

--
Bill Todd (TeamB)
TeamB cannot answer questions received via email