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

Formatting Pipeline problem

edited July 2004 in General
We store values as Decimals in the database and I want to show them in the
reports properly formated to 2 decimals.

The problem we have is when doing a mailmerge as we are using the end user
reports.

I've added the following code when we change to the Preview Tab under
ppDesignerTabChange

TppBDEPipeline(ppDesigner.Report.DataPipeline).OnTraversal :=
ppBDEPipelineTraversal;

I've added the following procedure, it fires the procedure, but the values
still look the same in the mail merge. I've also tried putting the procedre
(excluding the date formating part) on the PipeLine Open.

procedure TfrmReports.ppBDEPipelineTraversal(Sender: TObject);
var
Idx : LongInt;
begin
if Sender is TppBDEPipeline then begin

for Idx := 0 to Pred(TppBDEPipeline(Sender).FieldCount) do begin
case TppBDEPipeline(Sender).Fields[Idx].DataType of
dtDouble : TppBDEPipeline(Sender).Fields[Idx].DisplayFormat :=
'0.00';
dtDate : TppBDEPipeline(Sender).Fields[Idx].DisplayFormat :=
CRDateFormat;
dtDateTime : begin
if TppBDEPipeline(Sender).Fields[Idx].AsDouble < 1
then
TppBDEPipeline(Sender).Fields[Idx].DisplayFormat :=
'HH:NN AM/PM'
else begin
if
Frac(TppBDEPipeline(Sender).Fields[Idx].AsDouble) > 0 then
TppBDEPipeline(Sender).Fields[Idx].DisplayFormat
:= CRDateFormat+' HH:NN:SS'
else
TppBDEPipeline(Sender).Fields[Idx].DisplayFormat
:= CRDateFormat;
end;
end;
end;
end;

end;
end;


I can add a break point and see the value is correct, but it does not show
right in the mail merge?

Any ideas??????
TIA

Steve

Comments

  • edited July 2004
    Hi Steve,

    The DisplayFormat property on the datapipeline is only used for the Report
    Wizard. When ReportBuilder traverses your data, it retrieves it as raw data
    and then you can use the DisplayFormat property on each individual component
    to change the formatting. Unfortunately the MailMerge feature is not
    currently that advanced. It is on our to-do list to enhance this feature in
    many ways for the next relase of ReportBuilder. As a workaround, it is
    possible to manually search a RichText component and replace/reformat
    certain sections. See Demo 29 (dm0029.pas) located in the
    \RBuilder\Demos\1. Reports\... directory for an example of somthing similar
    to this.

    --
    Best Regards,

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