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

Mail Merge

edited November 2003 in General
Hi

I am currently using ReportBuilder Pro 7.02 with Delphi Professional 6,
Interbase OS 6.0.2.0 and IBX under windows XP Pro.

I have recently discovered the mail merge facility and am very impressed
with this inbuilt feature. It may save us from having to purchase a further
solution like wpTools.

One question however:

Is it possible to create a master/detail relationship where the details are
iterated through on the detail band of the master?

For example, a report may contain the outstanding invoices for a client.

While its is possible to set something like this up:

Dear

Please find below a list of oustanding invoices, dates and their amounts:



sincerely



Is it possible to do something like this without modifying the query:

Dear

Please find below a list of oustanding invoices, dates and their amounts:

,
,


sincerely



The above example will try and use the same line to display all the invoices
and then create a new line were necessary, saving space.

Thanks in advance.

Dominic

Comments

  • edited December 2003

    There is no support for the mail merge to traverse records. An alternative
    approach would be to write a utility routine that can do this. For an
    example of searching and replacing tags in the RichText see
    RBuilder\Source\ppRichTx.pas, the method MergeDBFields.

    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited December 2003
    Dominic,

    Here is a pass-through function I use to get around the limitation of
    reading from one table.

    Kevin

    {*** RTFReplace ***}

    procedure TrapRTFReplaceFunction.ExecuteFunction(aParams: TraParamList);
    var
    rt: TppRichText;
    srch,rplc: String;
    ii: Integer;
    begin
    GetParamValue(0,rt); //rich text component with tags to be replaced
    GetParamValue(1,srch); //srch=tag to be replaced
    GetParamValue(2,rplc); //rplc=value to substitute for tag

    ii:=rt.FindText(srch,0,Length(rt.RichText),[]);
    While ii>=0 do
    begin
    rt.SelStart:=ii;
    rt.SelLength:=Length(srch);
    rt.SelText:=rplc;
    ii:=rt.FindText(srch,ii,Length(rt.RichText)-ii+1,[]);
    end;

    SetParamValue(0,rt);
    end;

    class function TrapRTFReplaceFunction.GetSignature: String;
    begin
    Result:='procedure RTFReplace(rt: TppRichText; srch,rplc: String);';
    end;

    class function TrapRTFReplaceFunction.HasParams: Boolean;
    begin
    Result:=True;
    end;

    class function TrapRTFReplaceFunction.IsFunction: Boolean;
    begin
    Result:=False;
    end;

    Initialization
    raRegisterFunction('RTFReplace', TrapRTFReplaceFunction);
  • edited December 2003

    Very cool!

    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.