Subject | Re: [IBO] How to add Tfields persisntents with a TIBOquery in run-time? |
---|---|
Author | Delmar Wichnieski |
Post date | 2004-08-18T15:04:49Z |
> > I can't get sucessful trying to add persistents fields in run-time (notwith fields editor).
> > I'm tried this code:nprincipal.Memo1.Lines.Add(QrecepcaoAvisosPCconcluidoCODIGO.AsString);
> >
> > MyIBOquery.FieldDefs.Add('CODIGO',FTinteger,0,true);
> >
> > but in subsequent lines like this :
> >
> > message error: Access violation at address 005F0983 in modulemyproject.exe
> >qrecepcaoAvisosPCconcluido.FieldByName('CODIGO').OnGetText:=QrecepcaoAvisosP
> > in this:
> >
CconcluidoCODIGOgettext;
> >'field 'CODIGO' not found'.
> > Project projeto.exe raise exception class EDatabaseError with message
> >YourQuery.CaluclatedFields.Add( "CODIGO Integer" );
> > Any comment will be very appreciated.
>
> Your variable names are *far* too long. ;-)
>
> 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
My Delphi IDE don't display YourQuery.CaluclatedFields.xxxxxx. why?
My ibo version is 4.2.Ie.
CaluclatedFields is new in more recent versions?
In relation to "Your variable names are *far* too long" I reduce the name.
Now
QpcPronto.FieldDefs.Add('CODIGO', FTinteger,0,true);
but problem persist at QpcProntoCODIGO.OnGetText:=QpcProntoCODIGOgettext;
?????