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

Field Concatenation

edited October 2003 in General
I'm sure this is a simple question, but I'm fairly new to Report Builder,
and would like to know how I can concatenate two fields together. For
instance, I have a letter that I want to send to customers, and would like
to address the customer by name, such as
Dear Mark,

In this case I want to concatenate the first name field from the database,
and a comma after the first name.

Any help would be appreciated,
Paul

Comments

  • edited October 2003
    The best way to do this according to me, is to make a calcfield on your
    table or query.
    for instance Field XXX = 'Dear' + ' ' + Name + ','
    So you can select this field in your rb.

  • edited October 2003
    Hi,

    This is correct, it is always a good idea to preprocess your data before
    letting ReportBuilder handle it. This makes for a better running report
    with few output surprises as this was the way ReportBuilder was designed to
    work. However, you can also use a TppVariable to concatinate a field inside
    ReportBuilder. For instance in the TppVariable.OnCalc event:

    procedure TForm.ppVariable1Calc(Sender: TObject; Value: Variant);
    begin
    Value := 'Dear ' + Report.DataPipeline['FirstName'] + ',';
    end;

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.