Page 1 of 1

LookupKeyFields

Posted: 30.12.2005, 19:12
by darkbrain
Hi all,
are LookupKeyFields and KeyFields capable of multiple fields to obtain a primary key to search into LookupDataSet? I'm using semicolon to separete them but a EDataBaseError is raised (Field not found)

thanks,
DarkBrain

Posted: 31.12.2005, 00:13
by MarkusD
Hi DarkBrain,

it should work as you described, but a little bit more information would be useful:

What DB?
What Version of DB?

I suppose you are using ZeosLib 6.5.1?

What is your failing line of code?

Best Regards,
Markus Dütting

Posted: 31.12.2005, 13:04
by darkbrain
MarkusD wrote:Hi DarkBrain,

it should work as you described, but a little bit more information would be useful:

What DB?
What Version of DB?
Firebird 1.5 for windows
MarkusD wrote: I suppose you are using ZeosLib 6.5.1?
Yep, are there some patch? Where?
MarkusD wrote: What is your failing line of code?
This is strange because my delphi7 doesn't show me which code line has raised the exception. The Exception is SFieldNotFound1 and can be raised from ZdbcInterbase6Utils:1420 or ZDbcASAUtils:481 .
My search fields are integer and the result one is a string.
MarkusD wrote: Best Regards,
Markus Dütting
Tnx,
DarkBrain

Posted: 02.01.2006, 23:10
by darkbrain
I can't find it. Ah if it can help, the exception is reised in a loop and it doesn't end. Where i should look to trace the zeoslib code?

tnx,
DarkBrain

Posted: 03.01.2006, 02:00
by Woodzzter
To locate your line of code, download and install something like MadExcept which will trap the exception and also show you a call stack to locate the path to the exception.

Definitely a product worth purchasing (although for a non commercial product there is no fee to use it).This should definitely help you locate the error a lot easier.

(No - I do not have anything to do with the MadExcept product - I am just a user of it!)

Posted: 03.01.2006, 16:55
by darkbrain
Woodzzter wrote:To locate your line of code, download and install something like MadExcept which will trap the exception and also show you a call stack to locate the path to the exception.
Thanks for your tips, it's very usefull!!!
Any here is what i found:
Following is the reply I got from someone at Borland about the
problem.

Dear xxx,

Thank you for submitting your bug report. It has been confirmed
that this is not a bug. Lookup controls do not currently handle
multiple field lookups. It is a feature that has been requested
by some others, but is not currently implemented in any versions
of Delphi.

Thank you.
Richard Ponton, Developer Support
:shock: :shock: :shock: :shock:

Any suggestion? (other than use only one keyfield)

bye,
DarkBrain

Posted: 03.01.2006, 18:58
by MarkusD
Hello DarkBrain,

i thought you were using the Lookup or Locate method of a TDataSet. There you can use multiple fields seperated with semicolons.
You want to use a fkLookup field with multiple references?

The easiest way you can achive this imho would be using a calculated field ( FieldKind fkClalculated) and calling e.g. the Lookup method in the OnCalcFields event to populate it ( you can only change a calculated field there). But beware if you have AutoCalcFields activated then OnCalcFields is called quite often and can slow down your program quite easily ( as well as lookup fields btw). Especially if you aren't using a memory table ( e.g. kbmMemTable) for the lookup dataset. Anyway i couldn't get calculated fields correctly working without enabling AutoCalcFields ( Lookup Fields also don't working correctly without, at least in Delphi 4).

Best Regards,
Markus Dütting