Data.DB.TField OnGetText

edited October 2014 in FastReport VCL 5
Here is a small sample of code I use. This is not code form our commercial app but a sample of working code.

I assign the OnGetText of many fields from queries to a procedure to handle the formatting of the data from those fields.

Here is a sampleof the code.

queryDatasource.DataSet:= query;
query.FieldByName('myfield').OnGetText:= OnGetFieldText;

procedure TMyForm.OnGetFieldText(Sender:TField; var Text:String; DisplayText:Boolean);
begin
Text:= Sender.AsString;
Text:= 'My Extra Text '+Text;
end;

If I attach the TDataSource queryDatasource to a datagrid.Datasource the procedure OnGetText is called. If I assign the TDataSource queryDatasource to the TfrxDBDataset.Datasource for my report OnGetText event is never called and the data from the field is presented to the report straight from the database.

Attached is a picture showing the report without the extra data from the OnGetText and a grid with the extra data as expected.

Comments

  • gpigpi
    edited 10:13AM
    FR doesn't use TDataset.OnGetText

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.