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

changing string in memo

edited August 2003 in RAP
I am running RB7.02, D7, WinXP.

My GroupFooterAfterPrint Event has a line like the following:

Memo3.Lines[0] := newstring;

The event blows an error. There is at least 10 lines in the memo and if I
put a showmessage(Memo3.Lines[0]) call before the line above it works fine.
All calls to Memo3.Lines.Add(str) work fine.

Any ideas?

Yelena

Comments

  • edited August 2003
    Hi Yelena,

    It works fine in tests here. What other code do you have that is relying on
    this memo? What are you trying to do by changing the memo after the group
    footer prints? In which band is the memo? If you still can't resolve the
    issue, please send a zimple example that reproduces the problem to
    support@digital-metaphors.com and we'll be happy to take a look at it.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited August 2003
    Here is the code we used located in the group header after print event.
    Memo1 and 2 are located in the summary section of the report.

    var
    s : String;
    i : Integer;
    begin

    { format string to exact length before looking in memo field }
    s := FormatString('AAAAAAAAAAAAAAA', PipeBody['DEP_DESC_1']);
    i := Memo2.Lines.Indexof(s);

    if i < 0 then
    Memo2.Lines.Add(s)
    else
    Memo3.Lines[i] := 'Duplicate ' + s;
    end;


  • edited August 2003
    Here is my test project I created given the information you have provided.
    It seems to work fine in RAP:

    http://www.digital-metaphors.com/tips/SetSummaryMemoInGroupEvent.zip

    See if you can reproduce the problem with this and send it back to me (attn
    Jim) support@digital-metaphors.com


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited August 2003
    I ran your example and it never gets to the else part of the if statement.
    There is no line that states 'Duplicate' + s.
    The error occurs only when that else part is in effect.

    What should I do?

  • edited August 2003
    The problem is that Memo3 has no lines defined on it. You have to add memo
    lines in order to references Memo3.Lines[n]. Try adding blank lines to the
    Memo3 in the report when in the designer if you want to specify the nth line
    to be 'Duplicate' + s. That should do the trick.


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.