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

Add string to memo box from subreport.

edited July 2002 in General
Hi.

I have made a subreport with a Variable component which is invisibel. The
code in the OnCalc event look like this :

procedure Variable1OnCalc(var Value : Variant);
begin
Value := Value + ', ' + ppDBPipeline1[PladsNr];
end;

What I get out of this code is a string that look something like this :

A1, B2, B3

On the headreport I have a memo box which I added some other data in the
BeforeGenerate event.
What I want is to add the string to memo box that was genereted by the
Variable component, but I have tried all the events but it does not seem to
work. Can anyone help me.

Thanks

J?rgen

Comments

  • edited July 2002
    The OnCalc event should fire before the other events when the band prints.
    You could place all of the code to populate the memo lines inside of the
    variable's OnCalc event handler. This would guarantee that the variable
    value would be included in the memo.


    Cheers,

    Jim Bennett
    Digital Metaphors Corp.

  • edited August 2002
    Hi again.

    I have tried what you have wrote, but it seem that it does not work, maybe I
    have done something wrond. If I ask you nicely parhaps you could send me an
    exemple in code that I could implementat.

    Thanks

    J?rgen

  • edited August 2002
    As long as the subreport with the variable prints before the memo in the
    bad, then you are ok. Does the memo shift relative to the subreport? How
    are they positioned? If the memo is above the subeport, the the memo will
    have already generated before the subreport has a chance to print.

    procedure TForm1.ppVariable1Calc(Sender: TObject; var Value: Variant);
    begin

    Value := 'A1, B2, C3';

    ppMemo1.Lines.Add('Hello World');
    ppMemo1.Lines.Add(Value);

    end;


    Cheers,

    Jim Bennett
    Digital Metaphors Corp.

This discussion has been closed.