Reference TQuery fields in Report Event Code syntax

Hi,

I have a report connected to a tquery 'MyQuery' via a tfrxDBDataset, and it works of course very well :-)

Now I need to create a Groupdata band OnBeforePrint event in FR's IDE Event view (pascal mode).

I need to know how the following Delphi code would look like in this FR IDE Event code view. I did not find how to reference the TQuery and its fields.

****************************************
if MyQuery.FieldByName('FieldA').AsString > '' then
FRLabel1.Memo.Text := 'Filled with something'
else
FRLabel1.Memo.Text := 'Empty';
****************************************

Thanks a lot for helping me out with this
regards
Tor

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 8:34PM
    Tor
    sample
    Can i access to dataset fields with an index ?

    <frxDataset."MyField"> to frxDataset.Fields

    var
    i: Integer;
    ds: TfrxDataSet;
    list: TStringList;

    ds := Report.GetDataset('frxDBDataSet1');
    list := TStringList.Create;
    ds.GetFieldList(list);

    for i := 0 to list.Count - 1 do
    somevar := ds.Value[list]; // get field value by its name

    the best place to do this is in the empty begin end block of code in report script it is the first processed

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.