Subject | Re: [IBO] How to add Tfields persisntents with a TIBOquery in run-time? |
---|---|
Author | Daniel Albuschat |
Post date | 2004-08-18T07:16:43Z |
On Tue, Aug 17, 2004 at 03:08:34PM -0300, Delmar Wichnieski wrote:
But anyways, why don't you use a calculated field?
Simply do
YourQuery.CaluclatedFields.Add( "CODIGO Integer" );
And in OnCalculateField (of YourQuery):
if( AField.FieldName = "CODIGO" ) then
{
Assign your data, e.g. AField.AsString := "Test";
}
regards,
Daniel Albuschat
--
eat(this); // delicious suicide
> I can't get sucessful trying to add persistents fields in run-time (not with fields editor).Your variable names are *far* too long. ;-)
> I'm tried this code:
>
> MyIBOquery.FieldDefs.Add('CODIGO',FTinteger,0,true);
>
> but in subsequent lines like this :
> nprincipal.Memo1.Lines.Add(QrecepcaoAvisosPCconcluidoCODIGO.AsString);
> message error: Access violation at address 005F0983 in module myproject.exe
>
> in this:
> qrecepcaoAvisosPCconcluido.FieldByName('CODIGO').OnGetText:=QrecepcaoAvisosPCconcluidoCODIGOgettext;
>
> Project projeto.exe raise exception class EDatabaseError with message 'field 'CODIGO' not found'.
>
> Any comment will be very appreciated.
But anyways, why don't you use a calculated field?
Simply do
YourQuery.CaluclatedFields.Add( "CODIGO Integer" );
And in OnCalculateField (of YourQuery):
if( AField.FieldName = "CODIGO" ) then
{
Assign your data, e.g. AField.AsString := "Test";
}
regards,
Daniel Albuschat
--
eat(this); // delicious suicide