Subject Topic: KeyDescLinks with CalculatedFields bug?
Author mmenaz
Ibo 4.2Fp
I've a detail query that sub-selects a procedure to display a lookup
field. Everything worked fine until I defined a calculated field:
PERSONALE_CHIARO CHAR(1).
Even if the event handler qryMovConRigheCalculateField does nothing
(the only line is 'exit'), when I post the record instead of the
updated description I get the error:
'EIB_StatementError: Fieldname SEL_CODICI_CONTABILI.OUT_PARTITA_ID not
found'
The record is correctly posted (SQL monitor shows that the insert has
MOVCON_RIGHE.PARTITA value ok).
So seems that the field calculation code is making the mess on the
client side...
Any idea?
I've traced the following to get near the error flow, but I don't know
what is/should happen instead.

IBA_BDataset.IMP
procedure TIB_BDataset.CalculateFields;
...
KeyToChildAction( kcaUpdateKeyDescCalcFields, longint(Fields) );
...

The code in:
procedure TIB_Dataset.KeyToChildAction
that looks for that field is near the bottom:
...
TIB_Row( Info ).Values[ tmpVals ] :=
TIB_BDataset( ADataset ).Lookup(
tmpKeyVals, TIB_Row( Info ).Values[ tmpKeyFlds ], tmpFlds );
...

The error is generated by
function TIB_Row.ByName( const AFieldName: string ): TIB_Column;
when looking for 'SEL_CODICI_CONTABILI.OUT_PARTITA_ID' field.

For reproducing the bug I think you can use the GSG example of
KeyDescLinks and simply add a calculated field to the query.

Thanks
Marco Menardi


SELECT RIGA_CONTABILE_ID
, MOVCON_ID
, EDIFICIO_ID
, SCALA_ID
, PARTITA
, PERSONALE
, (SELECT OUT_DESCRIZIONEDISP
FROM SEL_CODICI_CONTABILI(:CONDOMINIO_ID, :ESERCIZIO_ID)
WHERE (OUT_PARTITA_ID = MOVCON_RIGHE.PARTITA))
AS PT_DESCRIZIONE_CONTO
, DARE
, AVERE
, DATA_SCADENZA
, DESCRIZIONE
FROM MOVCON_RIGHE