Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Dynamically outputting multiple fields

edited April 2003 in General
I am new to RB. Is there a way to use some sort of formula to concatenate
multiple fields at runtime like Quick Reports does with an "Expression" type
component? Right now I am using OnGetText() event handler but would like to
keep it encapsulated in the report template.

Thanks

--
Reid Roman
Future Generation Software
http://www.fgsoft.com

Comments

  • edited April 2003
    Reid,

    There are a couple ways to concatinate multiple fields. The easiest way is
    probably to create a TppVariable and add the fields to it directly from the
    datapipeline. Something like this...

    procedure HeaderBeforePrint(Sender: TObject);
    begin
    MyVariable.Value := Report.DataPipeline['city'] + ' ' +
    Report.DataPipeline['State'];
    end;

    You can also use a memo in a similar way with more fields. An example of
    this can be found in demo 33 located at \RBuilder\Demos\1. Reports\demo.dpr

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2003
    Ok thanks,..

    As I mentioned it would be nice to have an "Expression" type component that
    holds it's formula internally in a TStringlist or TCollection that gets
    streamed to the .rtm file so that it is more portable and encapsulated.
    Even if it only had a simple property editor to add strings rather than a
    utility to pick fields and dynamically build it, it would be a way of
    concatenating and/or formatting data like City, St, Zip without needing to
    add the code in the .pas unit. It would be more user freindly for the end
    user who will be designing custom reports.. (or is that where RAP comes
    in?)

    Are there third party RB components available? If not, sometime down the
    road I will investigate writing one.

    Thanks for the example. I will use the TppVariable method for the time
    being.


    --
    Reid Roman
    Future Generation Software
    http://www.fgsoft.com
  • edited April 2003

  • edited April 2003
    Nice components. I will download and evaluate them in the next few weeks or
    so. Right now I am getting use to RB and the project's immediate focus for
    the next couple of weeks will not be reporting.

    Thanks for the lead.


    --
    Reid Roman
    Future Generation Software
    http://www.fgsoft.com
This discussion has been closed.