Subject | Calculated field BUG |
---|---|
Author | Sascha.Mi@t-online.de |
Post date | 2002-03-25T16:52:05Z |
Hi ,
opening an IB_Query the first time, in the first CalculatedField event all
other columns contain NULL. The row does not show the correct content. A
workaround is calling RefreshAll() after Open() or closing and reopening the
query. It'd be a pity to have to do that. The fragments of an example below
are just for getting the idea.
IBO 4.2Gc
AutoFetchAll = true/false // no difference either
AutoFetchFirst = true/false // no difference either
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
IB_Connection1->Connect();
IB_Query1->Open();
IB_Query1->RefreshAll(); <--- Then all work's fine
}
//-------------------------------------------------------------------------
void __fastcall TForm1::IB_Query1CalculateField(TIB_Statement *Sender,
TIB_Row *ARow, TIB_Column *AField)
{
if ( AField->FieldName == "BES1" )
AField->Value = ARow->GetColumnValue("\"Bes_Name1\"");
else if ( AField->FieldName == "BES2" )
AField->Value = ARow->GetColumnValue("\"Bes_Name2\"");
}
Thanks,
Sascha Michel.
opening an IB_Query the first time, in the first CalculatedField event all
other columns contain NULL. The row does not show the correct content. A
workaround is calling RefreshAll() after Open() or closing and reopening the
query. It'd be a pity to have to do that. The fragments of an example below
are just for getting the idea.
IBO 4.2Gc
AutoFetchAll = true/false // no difference either
AutoFetchFirst = true/false // no difference either
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
IB_Connection1->Connect();
IB_Query1->Open();
IB_Query1->RefreshAll(); <--- Then all work's fine
}
//-------------------------------------------------------------------------
void __fastcall TForm1::IB_Query1CalculateField(TIB_Statement *Sender,
TIB_Row *ARow, TIB_Column *AField)
{
if ( AField->FieldName == "BES1" )
AField->Value = ARow->GetColumnValue("\"Bes_Name1\"");
else if ( AField->FieldName == "BES2" )
AField->Value = ARow->GetColumnValue("\"Bes_Name2\"");
}
Thanks,
Sascha Michel.