Page 1 of 1
Functions Locate or LooKup
Posted: Wed 17 Oct 2007 17:55
by Wilton
Hi,
After install MyDAC 5.20.0.11 for Delphi 5, when i try use
Functions Locate or LooKup and the result is the 1st line in
dataset, this functions doesn't work. What's happen?
Posted: Thu 18 Oct 2007 09:51
by Antaeus
I could not reproduce the problem.
Please send me a complete small sample at mydac*crlab*com to demonstrate it, including script to create and fill table.
Posted: Tue 23 Oct 2007 12:03
by Wilton
Hi Antaeus,
My problem occurs when I try to execute one lookup in the below described structure. In the VarArrayOf elements, when i have in wnsubit
variable a value number 1 (one) , his don't works, but using others values (like a 2) his works fine.
Code: Select all
ndatamod.NvouchBkn.Value := ndatamod.Ninvhot.LookUp('npasta;item;subit',VarArrayOf([ndatamod.ninvoicnpasta.Value,ndatamod.ninvoiciteste.Value,wnsubit]),'BKN');
CREATE TABLE `ninvhot` (
`Npasta` int(6) NOT NULL default '0',
`Item` int(3) NOT NULL default '0',
`Subit` int(3) NOT NULL default '0',
`Qtd` int(3) default NULL,
`Quarto` char(1) character set latin1 default NULL,
`Npax` int(3) default NULL,
PRIMARY KEY (`Npasta`,`Item`,`Subit`),
UNIQUE KEY `ninvhot` (`Npasta`,`Item`,`Subit`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Data in table
Npasta Item Subit Qtd Quarto Npax
541570 1 1 1 2
541570 2 1 1 2
This same behavior occurs using a Locate function
Code: Select all
if ndatamod.Ninvhot.Locate('npasta;item;subit',VarArrayOf([ndatamod.ninvoicnpasta.Value,ndatamod.ninvoiciteste.Value,wnsubit]),[]) then
begin
....
end;
Tks,
Posted: Wed 24 Oct 2007 07:39
by Antaeus
Thank you for this explanation. I used it to reproduce the problem, but the sample I've created works with no problems. If the wnsubit variable equals to 1 (one), both records can be found for data you posted. The functions cannot find records for other values of wnsubit on this data, as it is expected.
Please prepare a complete small sample that reproduces the problem.