Home Server

Webtier and ReportParameters

edited August 2011 in Server
Hi there,


We have a report with autosearch parameter for a combobox selection.
We are using the reportserver and webtier components where we send the
username for a logged in user from the isapi to the reportserver.
Then a reportexplorervolume is autocreated for each request which receives
the parameter in the BeforePublishReport -event and subsequently copied to
the Report.Parameters list.
When running the report the method SQLChanged in daMidas will receive the
parameter in the 'SQL.ReportParameters' property.

This works as expected the first time.

If I now make another selection in the combobox, the 'SQLChanged' method
will not find any parameters in 'SQL.ReportParameters'

I should note that after waiting a few minutes after running the first
selection, the second selection will run as expected. Is there a cache
which is out of sync?

Is there something I'm missing?



with regards,

Robbert Latumahina



{
RBuilderISAPI.dll
}
procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
{....}

lrsWebRequest := rsWebTier1.CreateWebRequest(Request.QueryFields,
Request.Content);
try
lrsWebRequest.VolumeName := 'ReportExplorer';
lrsWebRequest.ReportName := lReportName;

// Custom parameter, username supplied by CAS Server
lrsWebRequest.ServiceParameters.Items['USERNAME'].Value :=
lUserNameCookie;

Response.Content := rsWebTier1.ProcessWebRequest(lrsWebRequest);
finally
lrsWebRequest.Free;
end;

{....}
end;

{
udmReportExplorerVolume.pas

Retrieve USERNAME from ISAPI serviceparameter
}
procedure TDMReportExplorerVol.rsReportExplorerVolume1BeforePublishReport(
Sender: TObject; aEventParams: TrsBeforePublishReportEventParams);
begin
if (aEventParams.Report is TppReport) then
begin
TppReport(aEventParams.Report).Parameters.Add(aEventParams.ReportP
arameters);
end;
end;

{
daMidas.pas
}
procedure TdaClientDataView.SQLChanged;
var
lUsername: string;
begin
if SQL.ReportParameters.InList('USERNAME') then
lUsername := SQL.ReportParameters.Items['USERNAME'].Value;

(*
query authorization code snipped...
*)
end; {procedure, SQLChanged}




--- posted by geoForum on http://www.newswhat.com

Comments

  • edited August 2011

    For the first request a new session will be created, this will generate a
    SessionID. To optimize performance the WebTier and the Server both use
    caching.

    Open the Demos\WebTier\Custom Parameters example and review the code for
    TWebModule1.ProcessReportParameterRequest. Note that the logic sets a
    Refresh parameter to true, this is a built-in parameter that will avoid
    getting a cached report. Also note that the logic calls
    ValidateReportParameters - this will send the report parameters to the
    server.


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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited September 2011
    Thank you,

    It appears to work now with your suggestion.


    Robbert






    --- posted by geoForum on http://www.newswhat.com
This discussion has been closed.