TField lookups error with multiple key fields
Original Reporter info from Mantis: LesKaye
-
Reporter name: Leslie Kaye
Original Reporter info from Mantis: LesKaye
- Reporter name: Leslie Kaye
Description:
With a lookup field (FieldKind = fkLookup) multiple errors occur if there is more than one field listed in TField.KeyFields and TField.LookupKeyFields
for instance
"Invalid variant operation Array of Variant = Array of Variant"
and
"Field not found" in dataset when it does.
Different errors may be achieved by setting TField.LookupCache to True or to False
Additional information:
I attach a test project
Dbf1 has fields containing 2 char language IDs, month numbers and the month name according to the language and month number
Dbf2 contains a lookup field MONTH_NA which should return the month name according to language and month number data fields in Dbf2
Setting the lookup keys either to language or to month number works as expected. Set both language and month number as keys then errors occur.
I notice in the TLookupList implementation there are instances of:
V1 = V2
to test equality of variants .. the code should be
VarSameValue(V1,V2)
(I am not sure whether this works where the variant is an array maybe you have to test each element)
Mantis conversion info:
- Mantis ID: 13395
- Version: 2.2.5