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

TStringList.Add bug in RAP 14.05

edited July 2012 in General
Hi,

We have a report that in the first pass it stores a value into a
TSTringList, in the second pass it does calculations based on the stored
value corresponding to that Group.BreakNo.

In version 14.05 (with the new patches) the call to
MyStringList.Add(FloatToStr(Var1.Value)); adds an element to the StringList
but the value is not stored.

Trying the following workaround to assign the value raises an error.

-Jack

procedure GroupFooterBand1BeforePrint;
begin
if Report.FirstPass then
begin
AllTotal.Add(FloatToStr(vTotal.Value));
AllTotal[AllTotal.Count-1] := FloatToStr(vTotal.Value);
end;
end;

operating system : Windows XP Service Pack 3 build 2600
system language : English
executable : MyApp.exe
compiled with : Delphi 2010
madExcept version : 3.0l
callstack crc : $c7324be3, $70ca6313, $70ca6313
count : 3
exception number : 1
exception class : Exception
exception message : Could not run program: GroupFooterBand1BeforePrint
Access violation at address 00405A88 in module 'MyApp.exe'. Read of address
00000000.

main thread ($f88):
00880592 +022 MyApp.exe ppThreadedPageCache 315 +4
TppThreadedPageCache.ehExceptionTimer
004fc73b +00f MyApp.exe ExtCtrls TTimer.Timer
004fc5f3 +02b MyApp.exe ExtCtrls TTimer.WndProc
004af0a0 +014 MyApp.exe Classes StdWndProc
7e418a0b +00a USER32.dll DispatchMessageW
005944dd +11d MyApp.exe Forms
TApplication.ProcessMessage
00594522 +00a MyApp.exe Forms
TApplication.HandleMessage
0059484d +0c9 MyApp.exe Forms TApplication.Run
013cafa9 +0bd MyApp.exe MyApp 119 +16 initialization


Comments

  • edited July 2012
    Hi Jack,

    The TStringList.Add functionality in RAP seems to be functioning
    correctly in RAP.

    I would suggest adding a temporary variable to hold the string before
    adding it to the string list.

    var
    lsValue: String
    begin

    if Report.FirstPass then
    begin
    lsValue := FloatToStr(vTotal.Value);
    AllTotal.Add(lsValue);
    ...
    end;

    end;

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2012
    Temp Var doesn't help

  • edited July 2012
    Hi Jack,

    As I mentioned in my last post, the StringList.Add routine is working as
    designed in my tests. If it is not functioning for you there is
    something else going on. Please send a simple example demonstrating
    this issue that I can run on my machine in .zip format to
    support@digital-metaphors.com and I'll take a look at it for you.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2012
    I see now, it works with ppReport.Print, but if I add a ppViewer to my form
    and use PrintToDevices it does not work.

  • edited July 2012
    Try...

    if myReport.InitializeParameters then
    myReport.PrintToDevices;

    The above will fire the RAP GlobalOnCreate and the Report
    OnInitializeParameters events.

    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited July 2012
    Thanks

This discussion has been closed.