Home Server

ppreport1.OnBeforePrint/HTML issue

edited August 2003 in Server
I have and ISAPI.dll pointing to a server running as a service app.
I change the Database and SQL parameters in the ppReport.OnBeforePrint event

when I call the report content=PDF there is no problem because the report
prints all the way to the end and OnBeforePrint Fires only once, thus
creating ONE report file.
IF I call content=HTML, the server prints the first page to the viewer and
stops there.
If I use the next page button on the viewer, the OnBeforePrint Fires again,
and the code below fires again (and fails).
Unfortunately, at that point I have lost the AutoSeacrh params and the
second page fails due to the fact that the DB and params go thru again as
nil's

Is there a better place to call the below code so it only fires one time per
session ?
OR even better: Is there a way to force content=HTML to create one HTML file
instead of a file for each page?
-Maybe I can bypass the failing OnBeforePrint code if I knew if the session
was currently active and the code had already fired for that session?

I suppose I need a suggestion or two!
THANKS A BUNCH !

-Chester

//**************************************************************************
******
This is the ppReport.OnBeforePrint Code:
Capture DB and SQL values and set accordingly:

try //Get the SQL params for the query DateRange:
lAutoSearchField := ppReport1.AutoSearchFieldByName('PAIDDATE');
dStart := lAutoSearchField.Values[0];
dEND := lAutoSearchField.Values[1];
except on e:exception do
begin
SaveLogFile();
exit;
end;
end;

try // get the customer number:
lAutoSearchField := ppReport1.AutoSearchFieldByName('CustomerNum');
CustomerNum:= lAutoSearchField.Values[0];
except on e:exception do
begin
SaveLogFile('IATA_REP', e.message + ' 2GetASV');
exit;
end;
end;

try // get the DB alias
lAutoSearchField := ppReport1.AutoSearchFieldByName('DATABASE');
sDB := lAutoSearchField.Values[0];
SaveLogFile('IATA_REP','DB: '+ lAutoSearchField.Values[0]);
except on e:exception do
begin
SaveLogFile('IATA_REP', e.message + ' 3GetASV');
exit;
end;
end;

JChangeDB(sDB) // closeDB->setAliasOnDB->openDB

// set the params in the query using the AutoSearch Params
Try
Query.ParamByName('CustomerNum').AsString := trim(CustomerNum);
Query.ParamByName('START').AsDate := strtodate(dStart);
Query.ParamByName('END').AsDate := strtodate(dEND);
Query.Open;
Except on E:Exception do
Begin
SaveLogFile();
End;
End;
//**************************************************************************
******************************
: > )

Comments

  • edited August 2003

    Rather than Report.BeforePrint try using Report.OnGetAutoSearchFieldValues.
    For an example see dm0010.pas in the RBServer\Demos\Servers\Main
    application.

    For performance reasons, reports are generated incrementally, this is not
    something that I recommend be changed.




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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited August 2003
    Thanks Nard !

    One more issue:
    Now that I have moved the code to OnGetAutoSearchFieldValues all works great
    except:
    when I hit the next/last page button(s) in the viewer, there is no response
    except the nav buttons disapear!

    help?

    Thanks again.

    -Chester

  • edited August 2003

    Try going back to the RBServer demos. Then try modifying one of the demo
    incrementally to achieve the desired result.

    If you still have an issue, create a simple example, perhaps using a
    modified version of one of the demos that demonstrates this behavior and
    e-mail to support@digital-metaphors.com in zip format.





    Best regards,

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